Skip to content

Linux – Start, Stop, Restart Nginx WebServer

Last updated on June 4, 2022

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

(or)
$ /path/to/full/nginx -s start
$ /path/to/full/nginx -s stop
$ /path/to/full/nginx -s restart
$ /path/to/full/nginx -s reload

(or)
$ 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 nginx.conf.

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…

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments