A custom HTTP/HTTPS proxy server built using Python sockets and deployed on an AWS EC2 instance. The proxy sits between the user and the internet, forwards requests, blocks selected domains, manages concurrent users using OS synchronization concepts, and runs as a background Linux service.
This project demonstrates how a real proxy server works internally:
- Accepts client web requests
- Forwards them to target websites
- Returns responses back to users
- Supports HTTP and HTTPS
- Blocks restricted domains
- Handles multiple users using threads
- Limits concurrency using semaphore
- Uses mutex for safe logging
- Runs as a Linux background service using systemctl
- Deployed on AWS EC2
- Socket programming
- HTTP request forwarding
- HTTPS tunneling using CONNECT
- Client-server architecture
- Multithreading
- Semaphore (limit active clients)
- Mutex (safe logging & counters)
- Critical section handling
- Idle timeout management
- AWS EC2 instance
- SSH secure remote access
- systemd service management
- Public & private IP networking
User Browser ↓ Proxy Server (AWS EC2) ↓ Internet Websites
Control channel:
Laptop → SSH → AWS → Proxy
- HTTP request forwarding
- HTTPS secure tunneling
- Domain blocking (Facebook, Instagram, etc.)
- Activity logging
- Queue tracking (Active vs Waiting users)
- Idle timeout auto-release
- Multithreaded request handling
- Background execution using systemctl
| File | Purpose |
|---|---|
| server.py | Main proxy implementation |
| proxy.service | Linux systemd service config |
| proxy.log | Runtime activity logs |
- Choose Ubuntu
- Create new key pair → download
.pem
ssh -i proxy-key.pem ubuntu@<public-ip>
nano server.py
Paste proxy code.
python3 server.py
Runs until terminal closes.
Create service file:
sudo nano /etc/systemd/system/proxy.service
Add:
[Unit]
Description=Python Proxy Server
After=network.target
[Service]
ExecStart=/usr/bin/python3 /home/ubuntu/server.py
Restart=always
User=ubuntu
[Install]
WantedBy=multi-user.target
Enable and start:
sudo systemctl daemon-reexec
sudo systemctl enable proxy
sudo systemctl start proxy
From local machine:
curl -x http://<public-ip>:8080 http://example.com
HTTPS test:
curl -x http://<public-ip>:8080 https://example.com
Blocked site test:
curl -x http://<public-ip>:8080 http://facebook.com
View live activity:
sudo journalctl -u proxy -f
Log file:
tail -f proxy.log
Shows:
- Active clients
- Waiting queue
- Allowed requests
- Blocked requests
- Timeout releases
- Browser sends request to proxy
- Proxy accepts connection
- Semaphore checks available slot
- Thread created
- Block list checked
- HTTP forwarded OR HTTPS tunneled
- Response returned
- Connection closed
- Semaphore released
This project demonstrates real-world concepts:
- Computer Networks
- Operating Systems
- Cloud Computing
- Cybersecurity basics
- System-level programming
- Service deployment
- Web dashboard for analytics
- Request caching
- Intrusion detection
- Traffic monitoring graphs
- Load balancing support
Proxy Server built as a learning project combining OS, networking, and cloud deployment to understand how real internet gateways operate.