
- Create a
subdomain.domain.tld file under /etc/nginx/sites-available using the following:
server {
server_name subdomain.domain.tld;
location / {
proxy_pass http://127.0.0.1:DOCKERPORT;
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 Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
access_log /var/log/nginx/subdomain.domain.tld-access.log;
error_log /var/log/nginx/subdomain.domain.tld-error.log;
}
- Symlink to
/etc/nginx/sites-enabled with the following command:
cd ../sites-enabled/
sudo ln -s ../sites-available/subdomain.domain.tld subdomain.domain.tld
- Test nginx config:
sudo nginx -t
- If that passes, reload nginx:
sudo systemctl reload nginx
- Generate certs:
sudo certbot --nginx -d subdomain.domain.tld