NGINX Reverse Proxy setup

1. Install & start the NGINX

  • sudo yum install nginx
  • service nginx start
  • service nginx on

2. Update nginx.conf file to configure reverse proxy

http {
server {
listen 80;
server_name *.com; #change to your website URL
location / {
proxy_set_header x-real-IP $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header host $host;
proxy_pass http://54.69.161.197; #change to your IP
}
}
server {
listen       80 default_server;
listen       [::]:80 default_server;
server_name  localhost;
root         /var/www/;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;

location / {
    proxy_set_header x-real-IP $remote_addr;
    proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
    proxy_set_header host $host;
    proxy_pass https://54.69.161.197; #change to your IP pointing to my website “mylinuxguru.com”
        }

 3. Restart the NGINX

  • service nginx restart

4. Hit your Proxy server (nginx) IP and it should redirect the traffic to 54.69.161.197

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>