I've been experimenting with nginx using Docker image nginx.
docker run -d --name nginx nginx
docker exec -ti nginx bash
# <edit /etc/nginx/conf.d files>
Now in order to load the edited /etc/nginx/conf.d files, I execute service nginx restart, which causes the container to stop, since the init process (nginx) terminated. Thus, I need to execute docker start nginx and docker exec -ti nginx bash to resume.
Is there any way to restart nginx to have it load the edited config files without also stopping the container?
Call NGINX again with the -s command line parameter.
For example, /usr/bin/nginx -s stop will stop the NGINX server.
the other signals using with -s command are:
The reload command keeps the Nginx server running as it reloads updated configuration files. If Nginx notices a syntax error in any of the configuration files, the reload is aborted and the server keeps running based on old config files. Reloading is safer than restarting Nginx.
example: /usr/bin/nginx -s reload
nginx -t to check config is good
nginx -s reload to reload config without restart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With