I am trying to setup Nginx as reverse proxy (with HTTPS) for my app inside Docker. I already generated the certificate and it works (page shows the lock icon, which states it's secure with cert details), but i am struggling with setup proxy on Nginx.
I had generated cert with Certbot following this page https://certbot.eff.org/instructions?ws=nginx&os=debianbuster before i installed Nginx (i initially had wanted to manually setup HTTPS on Node, but then i heard about "reverse proxy", so i switched to Nginx attempt), so after i installed Nginx and added proxy_pass and server_name to nginx.conf, executing command nginx -s reload threw error, than my server name is already defined (because it has been in the Nginx default settings by Certbot). So then i tried to modify this default setup (before i had done a backup copy of file), which resulted in file including conflict (nginx.conf has like include sites-enabled/* directive, which also picked the backup file resulting in duplication). I removed my backup file and since then i cannot restart nor stop Nginx, because i receive error
ERROR : invalid PID number "" in "/run/nginx.pid"
I removed that file and the error is
nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)
Re-creating that file shows previous error. I tried stopping nxing service, which doesn't help. Trying to manually kill it's process is surprisingly tricky, becauseps -aux | grep 'nginx'shows one process, which very quickly increments it's PID ( 🤔 ), so i am unable to pick the current one to kill it. I tried restarting system, without success.
TLDR:
- i have HTTPS cert generated by Certbot
- i am trying to setup HTTPS reverse proxy by Nginx to my Docker app
- i received
server_nameconflicting error from Nginx after i tried modifying it to do proxy thing - now i cannot even stop Nginx, because it's PID is corrupted/gone