How To
Nginx Reverse Proxy

Set up an NGINX reverse proxy host

We are in Alpine Linux, a container. Assume we have port forwarding set up on our IP address to our container and the domain DNS pointing to our IP address.

In /etc/nginx/http.d/

Create a file with:

server {
    listen 80;
    listen [::]:80;

    server_name your_domain www.your_domain;

    location / {
        proxy_pass app_server_address;
        include proxy_params;
    }
}

Replacing your domain and the app server address (including https etc).

Try a rc-service nginx restart.

Try getting a certificate with certbot --nginx

It should work, and certbot should hopefully have updated your .conf file.

Last updated on January 8, 2024