Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Nginx、Uwsgi、Django发行_Python_Linux_Django_Nginx_Uwsgi - Fatal编程技术网

Python Nginx、Uwsgi、Django发行

Python Nginx、Uwsgi、Django发行,python,linux,django,nginx,uwsgi,Python,Linux,Django,Nginx,Uwsgi,我正在尝试用nginx和uwsgi运行一个django站点。所有配置对我来说都是正确的,uwsgi和nginx没有显示错误。但是网站仍然没有加载。nginx似乎根本没有读取conf文件。以下是进一步的细节 项目目录: /var/www/myproject/ /var/www/myproject/myapp /var/www/myproject/myproject/settings.py /var/www/myproject/myproject/wsgi.py Nginx配置: upstream

我正在尝试用nginx和uwsgi运行一个django站点。所有配置对我来说都是正确的,uwsgi和nginx没有显示错误。但是网站仍然没有加载。nginx似乎根本没有读取conf文件。以下是进一步的细节 项目目录:

/var/www/myproject/
/var/www/myproject/myapp
/var/www/myproject/myproject/settings.py
/var/www/myproject/myproject/wsgi.py
Nginx配置:

upstream django {
 server 127.0.0.1:8001;}
server {   
listen      8181;
server_name 0.my.ip.0
charset     utf-8;
client_max_body_size 75M;
location /media  {
alias /var/www/myproject/media;
}
location /static {
    alias /var/www/myproject/static;
}
location / {
    uwsgi_pass  django;
    include     uwsgi_params;
}}
UWSGI:

[uwsgi]
chdir           = /var/www/myproject/
module          = myproject.wsgi:application
master          = true
processes       = 5
max-requests    =5000
socket          = 127.0.0.1:8001
chmod-socket    = 664
vacuum          = true
daemonize=/my/log/file.log
我就是这样开始的

sudo uwsgi --emperor /etc/uwsgi/vassals --uid www-data --gid www-data
这是输出:

*** Starting uWSGI 2.0.11.1 (64bit) on [Sat Aug 15 12:51:58 2015] ***
compiled with version: 4.8.4 on 15 August 2015 03:50:24
os: Linux-3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015
nodename: ip-172-31-27-238
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /var/www/myproject
detected binary path: /usr/local/bin/uwsgi
setgid() to 33
setuid() to 33
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 7862
your memory page size is 4096 bytes
detected max file descriptor number: 1024
*** starting uWSGI Emperor ***
*** has_emperor mode detected (fd: 6) ***
[uWSGI] getting INI configuration from myproject.ini
Sat Aug 15 12:51:59 2015 - [emperor] vassal myproject.ini has been spawned
Sat Aug 15 12:51:59 2015 - [emperor] vassal myproject.ini is ready to accept         requests
我的uwsgi配置文件在
/etc/uwsgi/vassals
中有符号链接,而nginx conf在
/etc/nginx/sites中有符号链接,在这里它有一个
默认的
文件,用于欢迎页面,但我也删除了它。在我可以用来调试的nginx access.log和error.log中没有显示任何内容,当我打开myip:8181时,在浏览器中也没有显示任何内容

请看一看conf,让我知道可能是什么问题或如何调试它

编辑:
以上设置正确,问题是我尝试的端口被阻止:(

确保没有防火墙阻止8181端口访问

另外,请确保nginx服务正在侦听8181端口


netstat-ntpua | grep8181

确保没有防火墙阻止8181端口的访问

另外,请确保nginx服务正在侦听8181端口


netstat-ntpua | grep 8181

sudo netstat-ntpua | grep 8181什么也不返回。但很可能你是对的,只有当我有
服务器{listen 80 default_server;listen[::]你可以考虑使用套接字而不是端口8181SUDO NETSTAT,NTPUA GRIP 8181没有返回任何东西。但是很可能你是对的,只有当我有<代码>服务器{监听80 Debug ToServer时,站点才工作,听:[:]80 Debug ToServIPv6OnIn=on;< /C>作为服务器设置。您知道为什么吗?您可以考虑使用套接字而不是端口8181。