uwsgi -i uwsgi.ini后访问不了,如何看出是哪出的错?

来源:14-3 uwsgi配置文件方式启动以及代码更新后的重启

szuxxy

2019-12-07

uwsgi.ini

 # mysite_uwsgi.ini file
    [uwsgi]

    # Django-related settings
    # the base directory (full path)
    chdir           = /root/szumooc190528
    # Django's wsgi file
    module          = szumooc.wsgi
    # the virtualenv (full path)

    # process-related settings
    # master
    master          = true
    # maximum number of worker processes
    processes       = 10
    # the socket (use the full path to be safe
    socket          = 127.0.0.1:8000
    # ... with appropriate permissions - may be needed
    # chmod-socket    = 664
    # clear environment on exit
    vacuum          = true
    virtualenv = /root/envs/szuenv

    # logto = /tmp/mylog.log

图片描述

python manage.py runserver 0.0.0.0:8000
uwsgi --http :8000 --module szumooc.wsgi
都可以,但是用uswgi.ini的就访问不了,也看不出哪报了什么错。

我这边在/etc/nginx/conf.d下有szu_nginx,如下:

  1 # upstream component nginx needs to connect to
  2 upstream django {
  3 # server unix:///path/to/your/mysite/mysite.sock; # for a file socket
  4 server 127.0.0.1:8000; # for a web port socket (we'll use this first)
  5 }
  6 # configuration of the server
  7 
  8 server {
  9 # the port your site will be served on
 10 listen      80;
 11 # the domain name it will serve for
 12 server_name 129.211.78.6 www.szumooc.com ; # substitute your machine's IP address or FQDN
 13 charset     utf-8;
 14 
 15 # max upload size
 16 client_max_body_size 75M;   # adjust to taste
 17 
 18 
 19 location /static {
 20     alias /root/szumooc180528/static; # 指向django的static目录
 21 }
 22 
 23 # Finally, send all non-media requests to the Django server.
 24 location / {
 25     uwsgi_pass  django;
 26     include     uwsgi_params; # the uwsgi_params file you installed
 27 }
 28 }
写回答

1回答

bobby

2019-12-09

uwsgi.ini启动的从这里来看是没问题的,但是你不能使用http请求访问8000端口,因为这里是监听的socket端口不是http协议,你需要使用nginx做跳转你是否通过nginx访问的?

0
3
szuxxy
回复
bobby
老师给你发消息了。
2019-12-13
共3条回复

Python3.6+django+xadmin,打造在线教育平台

【毕设】Python 2.7到3.6 完美适配,Django升级2.0

3677 学习 · 4038 问题

查看课程