码迷,mamicode.com
首页 > 系统相关 > 详细

记录一下在ubuntu 上配置nginx+uwsgi+flask出现的一点问题.

时间:2018-11-11 23:26:14      阅读:249      评论:0      收藏:0      [点我收藏+]

标签:man   ...   rsa   share   var   access   env   erro   param   

还没有解决

 

现在的情况很奇怪,

配置uwsgi通过启动脚本启动后,无法正常运行,相同代码在centos上完全没有问题,同样用的是venv的环境,

ubuntu,贴上nginx配置和uwsgi配置

uwsgi.ini

[uwsgi]
socket = 127.0.0.1:8001
wsgi-file=/home/rod/www/app.py
callable=app
touch-reload=/home/rod/www/
daemonize=/home/rod/uwsgi.log
pidfile= /home/rod/www/uwsgi.pid

processes = 1
threads = 2
stats = 127.0.0.1:9191l
即使手动启动好服务后....可以访问网页.但是
但是
但是
只要修改py文件重载后,链路被摧毁了.具体还在找原因

 

 

  nginx

server {
    listen 443 ssl;
    ssl on;
    server_name  xxxxx;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;
    ssl_certificate     /home/rod/xxxxx,crt;
    ssl_certificate_key /home/rod/xxxxx.key;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    location / {
	include uwsgi_params;
        uwsgi_pass 127.0.0.1:8001;
        uwsgi_param UWSGI_PYHOME /home/rod/www/env; 
        uwsgi_param UWSGI_CHDIR  /home/rod/www;
	uwsgi_param UWSGI_SCRIPT mohu:mohu;
    }


    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

}

server {
    listen 80;
    server_name xxxxx;
    rewrite ^(.*)$ https://$host$1 permanent;
}

  

 

尝试修改测试环境:

ini

可以实时载入修改的py....感觉也挺危险的..

还是喜欢用 reload指令,生产环境不敢乱动..

 

 1 [uwsgi]
 2 master =true
 3 socket = 127.0.0.1:8181
 4 vacuum = true
 5 chdir=/home/rod/www
 6 wsgi-file=/home/rod/www/app.py
 7 callable=app
 8 #touch-reload=/home/rod/www
 9 daemonize=/home/rod/uwsgi.log
10 pidfile= /home/rod/uwsgi.pid
11 processes = 1
12 threads = 2
13 enable-threads = true
14 stats = 127.0.0.1:9191
15 py-autoreload = 1

记录一下在ubuntu 上配置nginx+uwsgi+flask出现的一点问题.

标签:man   ...   rsa   share   var   access   env   erro   param   

原文地址:https://www.cnblogs.com/rodzheng/p/9943482.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!