Last active
January 9, 2022 13:44
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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