按着文档 https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html 做的
uwsgi --http :8000 --wsgi-file test.py
可以显示
uwsgi --socket :8001 --wsgi-file test.py
无法连接服务器
uwsgi log:
(venv) ubuntu@VM-49-116-ubuntu:~/code/blog/mmxy$ uwsgi --socket :8001 --wsgi-file test.py *** Starting uWSGI 2.0.17 (64bit) on [Wed Apr 11 02:19:40 2018] *** compiled with version: 5.4.0 20160609 on 09 April 2018 17:37:14 os: Linux-4.4.0-91-generic #114-Ubuntu SMP Tue Aug 8 11:56:56 UTC 2017 nodename: VM-49-116-ubuntu machine: x86_64 clock source: unix detected number of CPU cores: 1 current working directory: /home/ubuntu/code/blog/mmxy detected binary path: /home/ubuntu/code/blog/venv/bin/uwsgi !!! no internal routing support, rebuild with pcre support !!! *** WARNING: you are running uWSGI without its master process manager *** your processes number limit is 3306 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 bound to TCP address :8001 fd 3 Python version: 3.6.4 (default, Apr 10 2018, 00:02:46) [GCC 5.4.0 20160609] *** Python threads support is disabled. You can enable it with --enable-threads *** Python main interpreter initialized at 0xe92290 your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 72920 bytes (71 KB) for 1 cores *** Operational MODE: single process *** WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0xe92290 pid: 8870 (default app) *** uWSGI is running in multiple interpreter mode *** spawned uWSGI worker 1 (and the only) (pid: 8870, cores: 1)
nginx 配置 mysite_nginx.conf
upstream django { # server unix:///tmp/mmxy.sock; server 127.0.0.1:8001; # for a web port socket (we'll use this first) } server { listen 8000; server_name 140.143.242.243; # server_name sususuus.xyz; charset utf-8; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; # max upload size client_max_body_size 75M; # adjust to taste # Django media location /media { alias /home/ubuntu/code/blog/mmxy/media; } location /static { alias /home/ubuntu/code/blog/mmxy/static; } # Finally, send all non-media requests to the Django server. location / { uwsgi_pass django; include /etc/nginx/uwsgi_params; } }
直接访问服务器, 有 Nginx 的欢迎界面
尝试给 uwsgi --socket :8001 --wsgi-file test.py
加一些参数 --protocol=http -b 30000 limit 128
都是无法连接服务器
nginx 下的 /var/log/nginx/error.log 是个空文件, 不知道为什么
尝试了各种办法, 重装了两次系统了, /(ㄒoㄒ)/~~
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.