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即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM