Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| server_configuration:squid [2021/04/15 06:36] – david | server_configuration:squid [2025/03/27 15:42] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Squid Proxy ====== | ||
| + | |||
| + | '' | ||
| + | - [[http:// | ||
| + | |||
| + | ===== Install ===== | ||
| + | |||
| < | < | ||
| apt-get update && apt-get upgrade -y | apt-get update && apt-get upgrade -y | ||
| apt-get install squid3 | apt-get install squid3 | ||
| + | # Backup original configuration to file named squid.conf.factory | ||
| cp -v / | cp -v / | ||
| - | |||
| - | |||
| </ | </ | ||
| - | Firewall | + | ===== Firewall | 
| See notes under: [[server_configuration: | See notes under: [[server_configuration: | ||
| + | |||
| < | < | ||
| ufw status | ufw status | ||
| ufw allow squid | ufw allow squid | ||
| - | ufw reload | ||
| ufw status | ufw status | ||
| </ | </ | ||
| + | |||
| + | ===== Configure Squid ===== | ||
| + | |||
| + | View the existing squid conf (with comments/ | ||
| + | < | ||
| + | cat / | ||
| + | </ | ||
| + | |||
| + | Configure password store using apache, see docs online... I didn't set this up yet (I limited by IP). | ||
| < | < | ||
| 400 apt-get install apache2-utils | 400 apt-get install apache2-utils | ||
| Line 26: | Line 41: | ||
| </ | </ | ||
| - | View the existing squid conf (with comments/documentation cut out) | + | Toggle blanket allow/deny rule (debugging to see if its your rule, or your application trying to connect which isn't configured properly) | 
| < | < | ||
| - | cat / | + | sed -i ' | 
| + | |||
| + | sed -i 's, | ||
| </ | </ | ||
| + | |||
| < | < | ||
| - | sed -i 's,http_access deny all,http_access allow all,g' / | + | # Add rule (BEFORE line matching sed pattern) | 
| + | sed -i '/http_access deny all/i http_access allow my_allow_ip' | ||
| + | sed -i '/ | ||
| - | sed -i 's, | + | # Delete rule by sed pattern | 
| + | sed -i '/acl my_allow_ip src xxx.xxx.xxx.xxx/ | ||
| + | </ | ||
| + | < | ||
| + | # Test config | ||
| + | squid -k parse | ||
| + | |||
| + | # Refresh configuration | ||
| + | squid -k reconfigure | ||
| </ | </ | ||
| + | |||
| + | ===== Stopping ===== | ||
| < | < | ||
| + | # Kill squid | ||
| sudo squid -k shutdown | sudo squid -k shutdown | ||
| + | |||
| + | # Restart Daemon: http:// | ||
| + | squid -s | ||
| + | </ | ||
| + | |||
| + | More from: http:// | ||
| + | |||
| + | < | ||
| + | ps aux | grep squid | ||
| + | </ | ||
| + | |||
| + | Check cache usage: | ||
| + | < | ||
| + | sudo du -h /var/spool/ | ||
| </ | </ | ||