请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

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

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 }

正在回答 回答被采纳积分+3

1回答

bobby 2019-12-09 11:51:13

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

0 回复 有任何疑惑可以回复我~
  • 提问者 szuxxy #1
    bobby老师,我这边是有在/etc/nginx/conf.d下有szu_nginx.conf的。我放到上面了,老师可以看下。
    回复 有任何疑惑可以回复我~ 2019-12-12 11:07:43
  • bobby 回复 提问者 szuxxy #2
    看起来配置都没有问题 你留下qq 我加你看看
    回复 有任何疑惑可以回复我~ 2019-12-12 17:50:15
  • 提问者 szuxxy 回复 bobby #3
    老师给你发消息了。
    回复 有任何疑惑可以回复我~ 2019-12-13 10:04:04
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信