@larissa
To redirect port 80 to a different server in nginx, you can use the 'proxy_pass' directive in your nginx configuration file. Here is a step-by-step guide on how to do this:
1 2 3 4 5 6 7 8 9 10 11 12 |
server {
listen 80;
server_name yourdomain.com;
location / {
proxy_pass http://new-server-ip-or-url;
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;
}
}
|
Replace 'yourdomain.com' with your actual domain name and 'http://new-server-ip-or-url' with the IP address or URL of the server you want to redirect port 80 to.
1
|
sudo nginx -s reload |
Now, any request to port 80 on your domain will be redirected to the new server specified in the proxy_pass directive.