본문 바로가기
  • Vetheuil in Summer
Tech/OS(Linux)

Squid Setting & Curl 명령어

by 눈꽃산행 2023. 10. 26.

http://www.squid-cache.org/

 

squid : Optimising Web Delivery

Squid: Optimising Web Delivery Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes

www.squid-cache.org

 

http://www.squid-cache.org/## 예시 ~~

EC2 ssh key 연동 접속

ec2-user  ssh (22)

 

sudo squid -f /etc/squid/squid.conf

ps -ef

sudo netstat -antpo

cat /etc/squid/

 sudo cat /etc/squid/squid.conf

 

cd /etc/squid/

 ls -rlt

sudo vi squid.conf

sudo service squid restart

 

curl Squid 서버IP:8080 https://www.타켓사이트 

 

** Linux OS에서 NAT된 IP 확인하기 ( Proxy IP )

[root@raspberry ~]# curl ifconfig.me

123.123.123.45

[root@raspberry ~]# curl bot.whatismyipaddress.com 123.123.123.45

https://ifconfig.me/

 

What Is My IP Address? - ifconfig.me

$ curl ifconfig.me/all ⇒ ip_addr: 211.231.103.94 remote_host: unavailable user_agent: facebookexternalhit/1.1; kakaotalk-scrap/1.0; +https://devtalk.kakao.com/t/scrap/33984 port: 38330 language: ko-KR,ko;q=0.8,en-US;q=0.6,en;q=0.4 referer: connection: ke

ifconfig.me

 

==================================================================

 

[ec2-user@ip-172-31-5-52 squid]$ sudo cat squid.conf
#
# Recommended minimum configuration:
#
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1

# 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 naming_A src 2.110.243.0/24
acl naming_A src 3.121.16.0/24
acl naming_A src 1.1.189.24.0/24
acl naming_A src .53.226.6/32
acl naming_A src 2.1.156.165/32
acl naming_A src 2.10.4.192/32
acl naming_A src 3.94.14.7/32
acl naming_B src 22.1.50.0/24


acl SSL_ports port 443
acl SSL_ports port 9443
acl SSL_ports port 1443
#acl Safe_ports port 80          # http
acl Safe_ports port 80-1024          # smaller ports
#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:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager

# 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

# 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
http_access allow naming_A
http_access allow naming_B
http_access allow naming_BSaving


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

# Squid normally listens to port 3128
http_port 8080

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

# 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

request_header_access X-Forwarded-For deny all
request_header_access Via deny all
[ec2-user@ip-172-31-5-52 squid]$

'Tech > OS(Linux)' 카테고리의 다른 글

공인 SSL 인증서 적용하기  (0) 2023.10.17
Server Load Average  (0) 2023.07.26
Linux Log (리눅스 로그파일 종류 및 분석)  (0) 2023.06.15
LVS (Linux Virtual Server)  (0) 2022.09.27
Linux firewall-cmd --list-all  (0) 2022.09.27