uwsgi + nginx配置 - nginx没有连接到uwsgi

时间:2014-07-22 04:40:02

标签: nginx flask uwsgi

我在尝试使用uwsgi配置nginx时遇到了麻烦。

我开始使用uwsgi:

uwsgi --plugin python,http --socket 127.0.0.1:8080 --wsgi-file hello.py --callable app --master

nginx.conf:

upstream uwsgicluster {
                server 127.0.0.1:8080;
}

server {

        # Running port
        listen 80;

        # Settings to by-pass for static files
        location /static/  {
            alias /home/ubuntu/projects/conradlabs_wow/wowcFlask/static/;
        }
        # Proxying connections to application servers
        location / {
            include            uwsgi_params;
            uwsgi_pass         uwsgicluster;
        }
}

当我点击ip而不是我的网页时,我仍然会获得默认的nginx主页。

我主要遵循提到的here

步骤

1 个答案:

答案 0 :(得分:0)

vi nginx.conf或/etc/nginx/vhosts.d/example.conf
  `

`

server {
            listen       80;
            server_name  example.com;

            #charset koi8-r;


    location / {

                include            uwsgi_params;
                uwsgi_pass         127.0.0.1:8080;


                proxy_redirect     off;
                proxy_set_header   Host $host;
                proxy_set_header   X-Real-IP $remote_addr;
                proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header   X-Forwarded-Host $server_name;

            }
    }


restart nginx