You can start,stop and restart Nginx web server by issuing any of the following commands from your terminal as a root user.
Based on your Linux flavor and Nginx installed location there will be little changes need,but most of the times below commands should work without any changes.
You can use following command to start,stop and restart Nginx sever. Following commands should work with any Linux distributions or Unix like operating systems:
$ nginx -s start
$ nginx -s stop
$ nginx -s restart
$ nginx -s reload
$ /path/to/full/nginx -s start
$ /path/to/full/nginx -s stop
$ /path/to/full/nginx -s restart
$ /path/to/full/nginx -s reload
$ service nginx start
$ service nginx stop
$ service nginx restart
$ service nginx reload
Generally we use reload command for reloading Nginx server after making any changes to the Nginx configuration file such as
In my case, I have compiled and installed nginx from source code at
/usr/local/nginx/sbin/nginx. So to start,stop and restart my web server I need to execute following commands –
$ /usr/local/nginx/sbin/nginx -s start
$ /usr/local/nginx/sbin/nginx -s stop
$ /usr/local/nginx/sbin/nginx-s restart
$ /usr/local/nginx/sbin/nginx -s reload
Thanks for reading…
I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.