2

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?

user700070
  • 153
  • 3
  • 8

1 Answers1

4

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