Linux Proxy Servers - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux Proxy Servers Guide
Complete beginner-friendly guide to proxy servers on Linux, covering Arch Linux, CachyOS, and other distributions including Squid, and proxy server configuration.
Table of Contents
Squid Setup
Install Squid
Install Squid:
# Arch/CachyOS
sudo pacman -S squid
# Debian/Ubuntu
sudo apt install squid
# Fedora
sudo dnf install squid
Configure Squid
Edit config:
# Edit config
sudo vim /etc/squid/squid.conf
Basic settings:
# HTTP port
http_port 3128
# Allow local network
acl localnet src 192.168.0.0/16
http_access allow localnet
# Deny all others
http_access deny all
Enable Service
Start Squid:
# Enable service
sudo systemctl enable squid
# Start service
sudo systemctl start squid
# Check status
systemctl status squid
Proxy Configuration
Access Control
Configure ACLs:
# Edit config
sudo vim /etc/squid/squid.conf
Add ACLs:
# Define networks
acl localnet src 192.168.0.0/16
acl worknet src 10.0.0.0/8
# Allow access
http_access allow localnet
http_access allow worknet
http_access deny all
Caching
Configure cache:
# Edit config
sudo vim /etc/squid/squid.conf
Cache settings:
# Cache directory
cache_dir ufs /var/cache/squid 100 16 256
# Cache size (MB)
cache_mem 256 MB
# Maximum object size
maximum_object_size 10 MB
Client Configuration
Browser Configuration
Configure browser:
- Open browser settings
- Network settings → Proxy
- Manual proxy configuration
- Enter: Proxy IP and port (3128)
System-Wide Proxy
Using environment variables:
# Set proxy
export http_proxy=http://proxy-server:3128
export https_proxy=http://proxy-server:3128
export no_proxy=localhost,127.0.0.1
# Make permanent
echo 'export http_proxy=http://proxy-server:3128' >> ~/.bashrc
Troubleshooting
Proxy Not Working
Check logs:
# Check Squid logs
sudo journalctl -u squid
# Check access logs
sudo tail -f /var/log/squid/access.log
# Check cache logs
sudo tail -f /var/log/squid/cache.log
Test Proxy
Test connection:
# Test proxy
curl -x http://localhost:3128 http://example.com
# Test with environment
http_proxy=http://localhost:3128 curl http://example.com
Summary
This guide covered proxy servers for Arch Linux, CachyOS, and other distributions, including Squid setup, configuration, and troubleshooting.
Next Steps
- Networking - Network setup
- Web Servers - Web servers
- ArchWiki Proxy: https://wiki.archlinux.org/title/Proxy_server
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.