Linux: Restart Nginx WebServer

by on July 8, 2009 · 3 comments· LAST UPDATED April 24, 2013


How do I restart nginx web server under Linux operating systems using command line options?

To restart the nginx web server use any one of the following command as a root user. Open a terminal or login to the remote server using ssh.

Debian/Ubuntu/RHEL/CentOS Linux

Use the following command:
# /etc/init.d/nginx restart
# /etc/init.d/nginx reload


# service nginx restart
# service nginx reload

However, recommend way is as follows. This should work with any Linux distributions or Unix like operating systems:
# nginx -s reload
# /path/to/full/nginx -s reload

If nginx compiled and installed from source code

If nginx binary is installed at /usr/local/nginx/sbin/nginx, enter:
# /usr/local/nginx/sbin/nginx -s reload

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 3 comments… read them below or add one }

1 Willie Jackson August 27, 2010 at 6:55 am

The method used is largely determined by whether NGINX was installed via package manager or compiled from source, correct?


2 ITN John April 24, 2013 at 8:17 pm

I guess so. If compiled from source use /path/to/nginx -s reload else use service nginx reload or service nginx restart


3 Minecraft December 2, 2014 at 4:41 am

Thanks for you,
I always use “service nginx restart” after config nginx


Leave a Comment

Tagged as: , , , , , , , ,

Previous Faq:

Next Faq: