What is the correct way to restart nginx inside the Discorse docker container?
The docker container appears to be running Debian 10, but the usual systemd approach for restarting nginx fails
[root@osestaging1 discourse]# ./launcher enter discourse_ose
root@osestaging1-discourse-ose:/var/www/discourse# cat /etc/issue
Debian GNU/Linux 10 \n \l
root@osestaging1-discourse-ose:/var/www/discourse# systemctl restart nginx
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
root@osestaging1-discourse-ose:/var/www/discourse#
It looks like there’s an init.d script, but running that fails. The logs say it’s because it can’t bind to an address already in-use.
root@osestaging1-discourse-ose:/etc/nginx/conf.d# /etc/init.d/nginx restart
[FAIL] Restarting nginx: nginx failed!
root@osestaging1-discourse-ose:/etc/nginx/conf.d# tail /var/log/nginx/error.log
2019/11/12 10:32:45 [emerg] 1123#1123: bind() to unix:/shared/nginx.http.sock failed (98: Address already in use)
2019/11/12 10:32:45 [emerg] 1123#1123: bind() to unix:/shared/nginx.http.sock failed (98: Address already in use)
2019/11/12 10:32:45 [emerg] 1123#1123: bind() to unix:/shared/nginx.http.sock failed (98: Address already in use)
2019/11/12 10:32:45 [emerg] 1123#1123: bind() to unix:/shared/nginx.http.sock failed (98: Address already in use)
2019/11/12 10:32:45 [emerg] 1123#1123: bind() to unix:/shared/nginx.http.sock failed (98: Address already in use)
2019/11/12 10:32:45 [emerg] 1123#1123: still could not bind()
2019/11/12 10:32:47 [emerg] 1127#1127: bind() to unix:/shared/nginx.http.sock failed (98: Address already in use)
2019/11/12 10:32:47 [emerg] 1127#1127: bind() to unix:/shared/nginx.http.sock failed (98: Address already in use)
2019/11/12 10:32:47 [emerg] 1127#1127: bind() to unix:/shared/nginx.http.sock failed (98: Address already in use)
2019/11/12 10:32:47 [emerg] 1127#1127: bind() to unix:/shared/nginx.http.sock failed (98: Address already in use)
Indeed, nginx is running already
root@osestaging1-discourse-ose:/etc/nginx/conf.d# ps -ef | grep -i nginx
root 46 40 0 10:19 ? 00:00:00 runsv nginx
root 1174 46 1 10:33 ? 00:00:00 /usr/sbin/nginx
root 1177 108 0 10:33 pts/1 00:00:00 grep -i nginx
root@osestaging1-discourse-ose:/etc/nginx/conf.d#
What’s the proper way to kill the above nginx process and start it again?