Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I made a new conf file in sites-available (and linked it in sites-enabled) and now I want to "install" that conf file without resetting the nginx server.

As root, I can run nginx -c file.conf since that almost does what I want; however, the conf files in sites-enabled seem to run within some other defined context when nginx starts because I always get the following error when running that command:

$ nginx -c /etc/nginx/sites-available/alpha
2010/09/30 02:32:13 [emerg] 31769#0: unknown directive "server" in sites-available/alpha:1

How can I dynamically run this new conf file?

$ nginx -v
nginx version: nginx/0.6.32
$ cat /etc/issue
Debian GNU/Linux squeeze/sid
$ cat /etc/nginx/sites-available/alpha
server {
    listen   443;

    ssl  on;
    ssl_certificate      /etc/nginx/certificates/server.crt;
    ssl_certificate_key  /etc/nginx/certificates/server.key;

    ssl_session_timeout  5m;

    ssl_protocols  SSLv2 SSLv3 TLSv1;
    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    ssl_prefer_server_ciphers   on;

    location / {

I am using self-signed certificates.

share|improve this question

Run the following command:

/etc/init.d/nginx reload

(or, on newer debian/ubuntu):

service nginx reload
share|improve this answer
RABBITZ# nginx -h
 -s signal     : send signal to a master process: stop, quit, reopen, reload

So you can use OS independent command:

nginx -s reload
share|improve this answer

Find PID of master process:

ps aux | grep nginx
root     22041  0.0  0.2   4808   684 ?        Ss   08:14   0:00 nginx: master process /usr/sbin/nginx
www-data 22042  0.0  0.4   4976  1044 ?        S    08:14   0:00 nginx: worker process
root     22044  0.0  0.3   3344   812 pts/1    S+   08:14   0:00 grep --color=auto nginx

And send HUP:

kill -HUP 22042
share|improve this answer
That PID is a worker process, not the master? – Nick Apr 15 '13 at 9:00

service nginx reload

Remember that reload is a gracefully way of any applying conf .It is more appropriate to use reload as it don't cause any downtime(restart causes some milisecs of downtime as it has to stop and then start again).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.