Is there a possibility to configure reverse proxy for a DNS record to an external URL where an application is hosted. If yes, how to configure it on already installed Nginx.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

The example configuration below should do the trick but is pretty basic. A more verbose configuration that addresses some common issues with this type of setup can be found here.

server {

       listen 80 default_server;
       listen [::]:80 default_server;


        root /var/www/html;

        index index.html index.htm index.nginx-debian.html;
        server_name _;


        location / {
        proxy_pass http://remote.application.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;
    }

}

Submit an Answer