Question

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

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.


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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

}