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 admittedly ran this:

sudo update-rc.d nginx defaults

which seemed to wipe out the setup of nginx. Nginx commands like sudo service nginx start, etc no longer return anything when executed. However, My nginx files for my django app are still existent in:

sudo vim /etc/nginx/sites-enabled/myapp
sudo vim /etc/nginx/sites-available/myapp

I ran a GREP on nginx and got: img

/etc/nginx/sites-available/myapp contains:

server {
        access_log /home/ubuntu/virtualenv/myapp/error/access.log;
        error_log /home/ubuntu/virtualenv/myapp/error/error.log warn;
        connection_pool_size 2048;

        root /home/ubuntu/virtualenv/myapp/homelaunch/;

        location /static/ {
            alias /home/ubuntu/virtualenv/myapp/homelaunch/static/;
            #alias /static/;
            #root /home/ubuntu/virtualenv/myapp/homelaunch/;

        location / {
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            #proxy_set_header X-Forwarded-Host $server_name;
            #proxy_set_header X-Real-IP $remote_addr;
            add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';

I have gunicorn, django 1.5 running as well

Why can't I use nginx anymore? How can I fix this? All the files still exist in their directories,and nginx is running as a service based on the screenshot above, but no commands are working. Is there someway to restore or something?

share|improve this question
up vote 2 down vote accepted

you nginx is NOT running, you see your grep-command; rather run: netstat -pltn | grep nginx

please run the following commands (root or sudo):

  • which nginx -> get the path to binary
  • nginx -t -c /etc/nginx/nginx.conf -> test nginx config
  • nginx -c /etc/nginx/nginx.conf -> start nginx with given config
  • netstat -pltn | grep nginx -> see on which ports nginx is listening
share|improve this answer
Wow, this worked! So should i be using nginx -c /etc/nginx/nginx.conf instead? – user700070 Sep 21 '13 at 19:38
Instead of sudo service nginx start – user700070 Sep 21 '13 at 19:58
no, you shouldnt. – that guy from over there Sep 22 '13 at 14:38

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.