Configure Nginx Reverse Proxy

To configure Nginx to act as a reverse proxy you will need to edit the default site config.

sudo nano /etc/nginx/sites-available/default

This is a boilerplate config referenced from Microsoft:

server {
    listen        80;
    server_name *;
    location / {
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;

After saving the configuration you can test that it’s valid:

sudo nginx -t

If the configuration file is valid you can reload Nginx and apply the new settings.

sudo nginx -s reload


If the service fails to start, you might get more insight by reviewing the logs.

sudo journalctl -fu Your_Service_Name.service


Host ASP.Net Core on Linux with Nginx: