2013-04-30 24 views
0

我需要使用ngnix和uwsgi部署我的django站点。它在localhost中工作正常。但是当我给我的远程服务器,它不起作用。这是我的ngnix.conf文件Django,ngnix和uwsgi站点无法在远程服务器上部署

# nginx.conf 
    upstream django { 
     # connect to this socket 
     server unix:///tmp/uwsgi.sock;  # for a file socket 
     #server 127.0.0.1:8001;  # for a web port socket 
     } 

    server { 
     # the port your site will be served on 
     listen  80; 
     # the domain name it will serve for 
     server_name 192.168.101.191;  # substitute your machine's IP address or FQDN 
     charset  utf-8; 

     #Max upload size 
     client_max_body_size 75M;  # adjust to taste 

     # Django media 
     location /media { 
        alias /home/calcey/django_env_2/employee/media;  # your Django project's media files 
     } 

      location /static { 
        alias /home/calcey/django_env_2/employee/static;  # your Django project's static files 
      } 

     # Finally, send all non-media requests to the Django server. 
     location/{ 
      uwsgi_pass django; 
      include  /etc/nginx/uwsgi_params; # or the uwsgi_params you installed manually 
      } 



     } 

“192.168.101.191”表示我的服务器IP地址。如果我把本地主机,而不是“192.168.101.191”它的作品。但对于远程IP,它不起作用。请给我一个建议。

+0

“不起作用”是什么意思?你见过日志吗?请尝试用更多细节来解释问题。 – TheBronx 2013-04-30 11:21:33

回答

0

您的服务器IP地址看起来像某种Internal IP。但无论如何,只要Nginx脚本在服务器上运行,就不需要任何服务器IP地址。

您可以改用以下配置:

Server { 
    listen 80; 
    server_name 127.0.0.1; 
    .... 
    .... 
    .... 
} 

希望这将解决您的问题。