티스토리 뷰

# squid란?
squid의 뜻은 오징어... 
왜 오징어인지는 아래 링크에 나와있다. 
http://www.squid-cache.org/
오픈소스 sw 프록시 서버이다.   proxy의 자세한 내용은https://jungtak.tistory.com/298
반복된 요청을 캐싱함으로써 웹서버의 속도를 올려준다. 

 

# squid 설치 진행

 

 

$yum install squid

 

 

y 이후 enter

 

#스퀴드(Squid) 구성

  1. squid/bin : squid 실행과 관련된 스크립트 파일이 있는 디렉토리
  2. squid/etc : squid 관련 환경 설정 파일인 squid.conf 가 있는 디렉토리
  3. squid/libexec : 서버운영과 관련된 스크립트 파일이 있는 디렉토리
  4. squid/lib : 프로그램 개발에 필요한 라이브러리 정보들이 있는 디렉토리
  5. squid/man : man 명령 관련 정보들이 있는 디렉토리
  6. squid/sbin : squid 서버를 실행하고 관리하는 squid 라는 명령이 위치하는 디렉토리
  7. squid/share : squid 를 사용하면서 발생하는 에러 메시지에 대한 정보들이 있는 디렉토리
  8. squid/var : 로그 파일에 대한 정보들이 있는 디렉토리

 

 

 

# default squid.conf

#
# Recommended minimum configuration:
#

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines

acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT

#
# Recommended minimum Access Permission configuration:
#
# Deny requests to certain unsafe ports
http_access deny !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports

# Only allow cachemgr access from localhost
http_access allow localhost manager
http_access deny manager

# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

# Squid normally listens to port 3128
http_port 3128

# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/spool/squid 100 16 256

# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid

#
# Add any of your own refresh_pattern entries above these.
#
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320

 

# squid 주요설정 
http_port xxxx
 - 스퀴드 서버 포트를 설정한다. (xxxx 포트로 설정)
cache_mem 8 MB
 - 스퀴드 서버에서 사용하는 캐시 사이즈를 설정한다.
maximum_object_size 4096 KB
 - 캐시 서버에 저장될 수 있는 객체 즉, 파일의 크기를 제한하는 옵션이다.
cache_dir ufs /usr/local/squid/cache 100 16 256
 - 캐시가 저장될 경로를 지정해주는 항목으로 크기와 생성될 하위 1차 및 2차 디렉토리의 수를 지정한다. 
 - 현재 설정은 /usr/local/squid/cache 디렉토리에 캐시데이터들이 최대 100MB 까지 저장될 수 있고, 캐시가 저장될 1차 디렉토리는 16 개로 설정하고 그 밑에 2차 디렉토리 수를 256 개로 설정한다.
cache_mgr admin
 - 캐시서버의 관리자 계정을 지정한다.
cache_mgr admin
 - 캐시서버의 관리자 계정을 지정한다.
cache_effective_user squid
cache_effective_group squid
 - 스퀴드 서버 캐쉬 디렉토리의 소유자와 소유자그룹을 나타낸다.
 - 현재 설정은 cache 가 squid 란 uid/gid 로 작동하도록 설정한다.

acl all src 0.0.0.0/0.0.0.0
 - ACL은 Access Control의 약자로 프록시 서버에 접근할 수 있는 범위를 설정하는 옵션으로 http_access와 함께 사용해야 한다. 
 - all의 범위는 src옵션으로 지정한 범위는 속하는 네트워크를 지정한다. 
 - 현재처럼 0.0.0.0/0.0.0.0으로 설정하면 모든 네트워크에 대해서 프록시서버에 접근할 수 있다. 
 - 자신의 프록시서버에 제한없이 모든 네트워크들이 접근할 수 있도록 설정한 후 httpd_access로 프록시 서버사용권한을 부여할 수 있다.

acl all src 0.0.0.0/0.0.0.0
http_access allow all
 - 모든 네트워크들이 자신의 프록시서버를 이용할 수 있게 지정한 것이다. 
 - 이 경우에는 네트워크 트래픽을 초래할 수 있다. 

acl members src 192.168.3.0/255.255.255.0
acl all src 0.0.0.0/0.0.0.0
http_access allow members
http_access deny all
 - 192.168.3.0 네트워크주소를 members 범위로 규정하여 http_access 에서 프록시서버 접속을 허용하고, 다른 네트워크에 대해서는 접속을 거부한다.

# 스퀴드(Squid) 서버 시작/종료

  1. squid.conf 에서 환경설정
  2. vi /squid/etc/squid.conf
  3. 캐시 영역으로 사용할 디렉토리를 /squid/var 하나위에 생성
  4. mkdir /squid/var/cache
  5. 모든 사람들이 접근할 수 있도록 허가권을 설정
  6. chmod 777 /squid/var/cache
  7. 캐시용 디렉토리를 초기화
  8. /squid/sbin/squid -z
  9. 데몬을 실행
    • /squid/sbin/squid
    • service squid start
  10. 데몬을 종료
    • squid -k shutdown
    • service squid stop
  11. 데몬을 재살행
    • squid restart
    • service squid restart
  12. 실행중인 데몬 확인
    • service squid status
    • ps -ef | grep squid

 

#예시 문제 
다음은 Squid 프록시 서버의 접근 제한 설정하는 과정이다. 조건에 맞게 ( 괄호 ) 안에
알맞은 내용을 적으시오.
( ① ) kait src ( ② )
http_access ( ③ ) ( ④ )
http_access ( ⑤ ) ( ⑥ )
■ 조 건
- 10.20.17.0 네트워크 대역에 속한 호스트만 허가하고, 해당 네트워크 대역에 속하지 않은
모든 호스트의 사용을 거부한다.
- 10.20.17.0 네트워크는 C클래스 대역으로 제한한다.

 

#답안

① acl 
② 10.20.17.0/255.255.255.0
또는 10.20.17.0/24 
③ allow 
④ kait 
⑤ deny 
⑥ all 



 

찍어서 풀지말고 확실하게 알고 풀자!

영어공부를 어디서부터 시작해야 할지 모른다면?

지금 바로 해커스에서 무료로 내 영어실력 확인하기

▽▽▽▽▽▽ 바로가기

https://bit.ly/3mggc1n

 

해커스인강 기초영어 레벨테스트

 

nefing.com

 

 

※ 해당 광고클릭은 필자에게 경제적으로 큰 도움이 됩니다.

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31