1. 更改uwsgi的配置文件uwsgi.ini
1[uwsgi] 2... 3#使用nginx连接时, 监控地址 4socket=127.0.0.1:8080 5#直接做web服务器时, 所监控地址 6#http=127.0.0.1:8080
2. 在nginx配置文件中的路由模块添加uwsgi支持.
sudo vim /usr/local/nginx/conf/nginx.conf
更改server模块.
1 server { 2 listen 80; 3 server_name localhost; 4 5 location / { 6 include uwsgi_params; 7 uwsgi_pass localhost:8080; 8 }
nginx配置全文:

1 1 worker_processes 1; 2 2 events { 3 3 worker_connections 1024; 4 4 } 5 5 http { 6 6 include mime.types; 7 7 default_type application/octet-stream; 8 8 sendfile on; 9 9 keepalive_timeout 65; 1010 1111 server { 1212 listen 80; 1313 server_name localhost; 1414 1515 location / { 1616 include uwsgi_params; 1717 uwsgi_pass localhost:8080; 1818 } 1919 2020 error_page 500 502 503 504 /50x.html; 2121 location = /50x.html { 2222 root html; 2323 } 2424 } 2525 }
Nginx配置全文
3. 重启nginx和uwsgi即可