0

由于我们有 cPanel Linux 服务器(Centos 6.4),我们已将其设置为在端口 80 上使用 Nginx(使用: http: //nginxcp.com/

我已经按照这个设置了 UWSGI: https ://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

如果我将监听设置为 8000 并使用http://example.com:8000 ,那么一切都按预期完美运行,但是如果我使用端口 80 ,它只会显示服务器 docroot 文件树。

任何建议或提示我解决此问题。

有关设置的一些信息:

netstat -tulpn 的结果 | grep:80

tcp        0      0 162.216.x.xx:80             0.0.0.0:*                   LISTEN      19656/nginx
tcp        0      0 162.216.x.xx:80             0.0.0.0:*                   LISTEN      19656/nginx
tcp        0      0 162.216.x.xx:80             0.0.0.0:*                   LISTEN      19656/nginx
tcp        0      0 0.0.0.0:8081                0.0.0.0:*                   LISTEN      16329/httpd

我的 nginx.conf :

# the upstream component nginx needs to connect to
upstream django {
    server unix:///var/uwsgi/incitollc.sock; # for a file socket
    }

# configuration of the server

    server {
        # the port your site will be served on
        listen      80;
        # the domain name it will serve for
        server_name example.biz www.example.biz 162.216.5.82; # substitute your machine's IP address or FQDN
        root /home/example/public_html/exampleapp;
        access_log /home/example/public_html/logs/access.log;
        error_log /home/example/public_html/logs/error.log;
        charset     utf-8;

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

        # Django media
        location /media  {
            alias /home/example/public_html/exampleapp/media;  # your Django project's media files - amend as required
        }

        location /static {
            alias /home/example/public_html/exampleapp/static; # your Django project's static files - amend as required
        }

        # Finally, send all non-media requests to the Django server.
        location / {
            uwsgi_pass  django;
            include     /home/example/public_html/uwsgi_params;
            }
        }

我的 uwsgi.ini:

[uwsgi]

chdir           = /home/example/public_html/exampleapp
module          = exampleapp.wsgi:application
home        = /home/example/public_html/exampleappenv
master          = true
processes       = 10
socket      = /var/uwsgi/exampleapp.sock
chmod-socket    = 666
vacuum          = true
gid         = nobody
uid         = nobody
pidfile     = /var/uwsgi/exampleapp.pid
4

1 回答 1

0

通过更改修复问题:

upstream django {
    server unix:///var/uwsgi/incitollc.sock; # for a file socket
    }

至:

upstream django {
    server unix:/var/uwsgi/incitollc.sock; # for a file socket
    }
于 2013-10-07T22:16:53.667 回答