To set up a basic proxy server, here’s a quick guide on the steps and tools you'll need:
1. Choose a Proxy Server Software:
- Squid: Popular for web traffic control; supports caching, access control, and logging.
- Nginx: Can be configured as a reverse proxy, often used for web servers.
- 3proxy: Lightweight and easy to configure, good for smaller setups.
2. Install the Proxy Software:
For Squid:
sudo apt-get update
sudo apt-get install squid -y
For Nginx:
sudo apt-get update
sudo apt-get install nginx -y
3. Configure Proxy Settings:
Squid: Edit the config file at /etc/squid/squid.conf to set the port, allowed IPs, and access control.
# Set the port
http_port 3128
# Allow specific IPs
acl allowed_networks src 192.168.1.0/24
http_access allow allowed_networks
Nginx: Configure reverse proxy in the /etc/nginx/sites-available/default file.
server {
listen 8080;
location / {
proxy_pass http://target_server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
4. Start and Enable the Proxy:
For Squid
sudo systemctl start squid
sudo systemctl enable squid
For Nginx
sudo systemctl start nginx
sudo systemctl enable nginx
5. Test the Proxy Server:
Configure your browser or application to use the proxy server’s IP and port.
6. Enable Logging:
Logging helps in monitoring traffic. Check the default logs and enable additional logging if needed in your proxy config.
7. Secure the Proxy Server:
Restrict access by IP, add authentication, and configure firewall rules to allow only necessary IP ranges