squid 정방 향 에이전트

3936 단어
내외 망 환경 은 네트워크 격 리 를 했 고 기계 한 대만 외부 망 에 접근 할 수 있 었 다.그래서 이 기계 에 프 록 시 서버 를 설정 하여 프 록 시 리 트 윗 을 합 니 다.이전에 Nginx 를 사 용 했 지만 nginx 가 https 요청 을 지원 하지 못 하 는 것 을 발 견 했 습 니 다. (강제로 지원 해도 됩 니 다. 추가 패키지, 소스 코드 컴 파일 이 필요 합 니 다. 고생 할 필요 가 없습니다)
다음 Squid 의 빠 른 설정 설 치 를 기록 합 니 다.
설치 하 다.
여러 가지 방식 으로 설치 할 수 있 습 니 다. 설치 한 후, 일반적으로 /usr/sbin/squid 기본 설정 파일 은: /etc/squid/squid.conf 입 니 다.
yum install squid

프로필 수정
루트 권한 이 없 으 면 자신의 디 렉 터 리 에 squid. conf copy 아래 demo 를 만 드 는 것 을 권장 합 니 다. (이것 은 기본 / etc / squid / squid. conf 에서 복사 한 것 입 니 다.)
일반적으로 서비스 포트 http port: 10000 로그 파일 경로 와 같은 것 만 수정 해 야 합 니 다.
루트 권한 이 없 으 면 로그 경 로 를 변경 하 십시오. pid 경 로 를 수정 하 십시오.
#
# Recommended minimum configuration:
#

# Squid normally listens to port 3128
http_port 10000  

# 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



# 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
cache_mem 32 MB
cache_dir aufs /home/wxadmin/app/squid/cache/ 1024 16 256
access_log /home/wxadmin/app/squid/log/access.log
cache_log  /home/wxadmin/app/squid/log/cache.log
pid_filename /home/wxadmin/app/squid/squid.pid

#
# 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 는 초기 화 를 해 야 사용 할 수 있 습 니 다. -f 매개 변 수 는 사용자 정의 프로필 을 지정 합 니 다. 일부 상용 명령 입 니 다.
#   
/usr/sbin/squid -f /home/wxadmin/app/squid/squid.conf -z
#   
/usr/sbin/squid -f /home/wxadmin/app/squid/squid.conf start
#   
/usr/sbin/squid -f /home/wxadmin/app/squid/squid.conf restart
#   
/usr/sbin/squid -f /home/wxadmin/app/squid/squid.conf -k shutdown

검사 하 다.
포트 가 서비스 에 있 는 지 확인 하 십시오.
netstat -lnp

설정 성공 여부 확인
curl -x 127.0.0.1:10000 https://www.baidu.com

좋은 웹페이지 즐겨찾기