How to proxy a Netlify site with Nginx

May 2, 2022

I wanted to proxy a path of my site to a Netlify site using Nginx.

In my example, I wanted the /swipes page of my website to show the Netlify site

First, locate your Nginx configuration file, which is probably stored on your server at /etc/nginx/nginx.conf. You can edit it using any editor, for example:

nano /etc/nginx/nginx.conf

Within the server block for your website, add a location block:

server {
    # Other existing stuff here.

    location /swipes {

Then reload your Nginx server to use the new configuration.

The important part is that the Netlify URL ends in a trailing slash. Without this, you’ll see a 404 Page Not Found page from Netlify.

But with the trailing slash, the /swipes page of your website should now show the proxied Netlify site!

Follow my twitter (@benborgers) to see the work-in-progress of coding projects I’m working on!