Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/296.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.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 将uwsgi与Nginx连接不起作用 解决了的 请参阅底部的修复程序等。_Python_Django_Nginx_Uwsgi - Fatal编程技术网

Python 将uwsgi与Nginx连接不起作用 解决了的 请参阅底部的修复程序等。

Python 将uwsgi与Nginx连接不起作用 解决了的 请参阅底部的修复程序等。,python,django,nginx,uwsgi,Python,Django,Nginx,Uwsgi,我试图通过uwsgi将我的django应用程序与nginx连接起来,但似乎没有将数据传递给uwsgi。我已经测试过uwsgi服务器是否正常运行,并且两端都没有任何日志输出 uwsgi.ini /etc/nginx/sites可用文件树 违约 serverDjango_nginx.conf serverDjango_nginx.conf: 更新: 首先,站点未启用。。。 其次,我在/etc/nginx/sites enabled/中添加了一个指向它的链接,如文档所述 现在我得到了这个wierd错误

我试图通过uwsgi将我的django应用程序与nginx连接起来,但似乎没有将数据传递给uwsgi。我已经测试过uwsgi服务器是否正常运行,并且两端都没有任何日志输出

uwsgi.ini

/etc/nginx/sites可用文件树

违约 serverDjango_nginx.conf serverDjango_nginx.conf:

更新: 首先,站点未启用。。。 其次,我在/etc/nginx/sites enabled/中添加了一个指向它的链接,如文档所述 现在我得到了这个wierd错误:

2020/03/29 12:14:18[emerg]43444344:open/etc/nginx/sites enabled/serverDjango_nginx.conf失败2:etc/nginx/nginx.conf中没有这样的文件或目录:63

我查看了相应的配置文件以查找

 include /etc/nginx/conf.d/*.conf;
 include /etc/nginx/sites-enabled/*;

现在我想知道为什么id找不到我链接到的文件

sudo ln-s~/etc/nginx/sites available/serverDjango_nginx.conf/etc/nginx/sites enabled/

更新编号2 因此linkagepath是错误的,因为:

sudo ln-s~/etc/nginx/sites available/serverDjango_nginx.conf

此处的波浪线强制使用相对路径,因此使链接无效这是一个生成Nginx配置文件的好工具。如果希望通过标准http/s端口访问,则应在服务器块中放置侦听器80或443。你也应该把你的服务器名作为你的域名,比如www.google.com google.com是的,包括这两个域名或者任何你想为Django网站服务的域名

我也不像你在“定位”下那样使用uwsgi。我只是像使用代理通行证一样使用代理通行证http://localhost:8001 然后为我的代理配置传递一个include

# the upstream component nginx needs to connect to
upstream django {
    #server unix:///path/to/your/mysite/mysite.sock; # for a file socket
    server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

# configuration of the server
server {
    # the port your site will be served on
    listen      8000;
    # the domain name it will serve for
    server_name 127.0.0.1; # 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  {
# location /media  {
   #     alias /path/to/your/mysite/media;  # your Django project's media files $
   # }

   # location /static {
   #     alias /path/to/your/mysite/static; # your Django project's static files$
   # }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include     /home/pi/Server/uwsgi_params; # the uwsgi_params file you in$
    }
 include /etc/nginx/conf.d/*.conf;
 include /etc/nginx/sites-enabled/*;