Nginx与uWSGI交互

1. 更改uwsgi的配置文件uwsgi.ini

[uwsgi]
...
#使用nginx连接时, 监控地址
socket=127.0.0.1:8080
#直接做web服务器时, 所监控地址
#http=127.0.0.1:8080


2. 在nginx配置文件中的路由模块添加uwsgi支持.

sudo vim /usr/local/nginx/conf/nginx.conf

更改server模块.

    server {
        listen       80;
        server_name  localhost;
        
        location / {
            include uwsgi_params;
            uwsgi_pass localhost:8080;
        }

 

nginx配置全文:

 1 worker_processes  1;
 2 events {
 3     worker_connections  1024;
 4 }
 5 http {
 6     include       mime.types;
 7     default_type  application/octet-stream;
 8     sendfile        on;
 9     keepalive_timeout  65;
10 
11     server {
12         listen       80;
13         server_name  localhost;
14 
15         location / {
16             include uwsgi_params;
17             uwsgi_pass localhost:8080;
18         }
19 
20         error_page   500 502 503 504  /50x.html;
21         location = /50x.html {
22             root   html;
23         }
24     }
25 }
Nginx配置全文

 

3. 重启nginx和uwsgi即可

posted @ 2019-10-16 12:28  Jrri  阅读(1045)  评论(0编辑  收藏  举报