Report this

What is the reason for this report?

Reverse Proxy for the internal DNS to an external IP or URL

Posted on May 23, 2018

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.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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;
    }

}

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.