Skip to content

Instantly share code, notes, and snippets.

@dinushchathurya
Last active January 9, 2022 13:44
Show Gist options
  • Save dinushchathurya/f7f1bb48e7eeac7f7bfd723fede401ea to your computer and use it in GitHub Desktop.
Save dinushchathurya/f7f1bb48e7eeac7f7bfd723fede401ea to your computer and use it in GitHub Desktop.
This contains all the required command use to configure Nginx as a reverse proxy for Apache
sudo vim /etc/apache2/sites-available/000-default.conf
sudo vim /etc/apache2/ports.conf
sudo systemctl reload apache2
sudo apt install nginx
sudo systemctl status nginx
sudo vim /etc/nginx/sites-available/default
proxy_pass http://{your ip or domain}:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
systemctl restart nginx
iptables -I INPUT -p tcp --dport 8080 ! -s {your ip or domain} -j REJECT --reject-with tcp-reset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment