uwsgi -i uwsgi.ini &执行之后不知如何排查问题
来源:10-7 pycharm远程代码调试-1
余泽锋
2017-11-07
nginx的配置
//按照教程的貌似不行 root@iZwz90hw6w4rniwnlsoxrhZ:/data/MxShop/conf/nginx# sudo /usr/sbin/nginx sudo: unable to resolve host iZwz90hw6w4rniwnlsoxrhZ nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) nginx: [emerg] still could not bind() //在网上找到另外一种启动方式 root@iZwz90hw6w4rniwnlsoxrhZ:/data/MxShop/conf/nginx# sudo /etc/init.d/nginx start sudo: unable to resolve host iZwz90hw6w4rniwnlsoxrhZ [ ok ] Starting nginx (via systemctl): nginx.service.
这是uwsgi -i uwsgi.ini &执行之后的/tmp/mylog.log
# mysite_uwsgi.ini file [uwsgi] # Django-related settings # the base directory (full path) chdir = /data/MxShop # Django's wsgi file module = MxShop.wsgi:application # 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 = /home/bobby/.virtualenvs/mxonline logto = /tmp/mylog.log
然后启动之后我还是没法访问我的东西,nginx的欢迎页面还是可以看得到,还有我是没用virtualenv,直接在服务器(ubuntu16.04)跑的。
这是我uc_nginx.conf文件内容 # 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:8000; # for a web port socket (we'll use this first) } # configuration of the server server { # the port your site will be served on listen 80; # the domain name it will serve for server_name XXX.XX.XX.XX; # 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 { alias /data/MxShop/media; # 指向django的media目录 } location /static { alias /data/MxShop/static; # 指向django的static目录 } # Finally, send all non-media requests to the Django server. location / { uwsgi_pass django; include /data/MxShop/MxShop/wsgi.py; # the uwsgi_params file you installed } }
写回答
1回答
-
这里有两个问题你需要注意 , 第一幅图中可以看出来 你的80端口已经占用了 你是否配置过apache占用了80端口 或者你是否已经通过其他方式启动了nginx导致现在启动不了nginx, 第二你的nginx的配置文件看起来没有问题 uwsgi启动也是正常的, 你是否通过域名方式访问了? server_name 120.78.95.99; 这句话表明只能通过ip访问才能访问
032017-11-13
Python前后端分离开发Vue+Django REST framework实战
Django REST framework课程视频,RESTFul API前后端分离开发
2873 学习 · 2457 问题
相似问题