Nginx Reverse Proxy Set Up ( Multiple Server On The Same Port One IP )

Опубликовано: 05 Октябрь 2024
на канале: Tate A
48,478
737

How to setup a reverse proxy with Nginx.


CLI

sudo nano /etc/nginx/sites-available/default


```


server {
listen 80;
server_name HOST_NAME_OF_YOUR_SIT;

location / {
proxy_pass http://YOUR_SERVER_IP:SERVER_PORT;
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;
}
}

server {
listen 80;
server_name HOST_NAME_OF_YOUR_SITE;

location / {
proxy_pass http://YOUR_SERVER_IP:SERVER_PORT;
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;
}
}


```


sudo systemctl reload nginx

Please like and subscribe!

#TateA