Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 {
        server_name ec2-x-x-x-x.compute-1.amazonaws.com;
        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_pass http://127.0.0.1:8001;
            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

1 Answer 1

up vote 1 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

 
discard

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.