nginx不再适用于ec2实例

我承认跑了这个:

sudo update-rc.d nginx defaults 

这似乎消灭了nginx的设置。 像sudo service nginx start这样的Nginx命令在执行时不再返回任何东西。 但是,我的django应用程序的nginx文件仍然存在于:

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

我在nginx上运行了一个GREP,得到: IMG

/etc/nginx/sites-available/myapp包含:

 server { server_name ec2-xxxx.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"'; } } 

我有gunicorn,django 1.5也跑

为什么我不能再使用nginx了? 我怎样才能解决这个问题? 所有的文件仍然存在于他们的目录中,nginx作为基于上述屏幕截图的服务运行,但没有命令正在工作。 有没有办法恢复或什么?

你的nginx没有运行,你看你的grep-command; 而是运行: netstat -pltn | grep nginx netstat -pltn | grep nginx

请运行以下命令(root或sudo):

  • which nginx – >获取二进制的path
  • nginx -t -c /etc/nginx/nginx.conf – >testingnginxconfiguration
  • nginx -c /etc/nginx/nginx.conf – >用给定的configuration启动nginx
  • netstat -pltn | grep nginx netstat -pltn | grep nginx – >查看nginx正在侦听的端口