onlyou13

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

 

Nginx配置

# HTTPS
    server {
        listen       443 ssl;
        server_name  kvaccount.xx.io;

        ssl_certificate      "C:/xx/conf/ssl/xx.crt";
        ssl_certificate_key  "C:/xx/conf/ssl/xx.key";

        #ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        
        location / {
            # 指定 fastcgi 的主机和端口
            fastcgi_pass 127.0.0.1:8008;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param REQUEST_METHOD $request_method;
            fastcgi_param QUERY_STRING $query_string;
            fastcgi_param CONTENT_TYPE $content_type;
            fastcgi_param CONTENT_LENGTH $content_length;
            fastcgi_param SERVER_PROTOCOL $server_protocol;
            fastcgi_param SERVER_PORT $server_port;
            fastcgi_param SERVER_NAME $server_name;
            fastcgi_pass_header Authorization;
            fastcgi_intercept_errors off;
        }
    }
# HTTP

    server {
        listen       80;
        server_name  kvaccount.xx.io;        
        location / {
            # 指定 fastcgi 的主机和端口
            fastcgi_pass 127.0.0.1:8008;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param REQUEST_METHOD $request_method;
            fastcgi_param QUERY_STRING $query_string;
            fastcgi_param CONTENT_TYPE $content_type;
            fastcgi_param CONTENT_LENGTH $content_length;
            fastcgi_param SERVER_PROTOCOL $server_protocol;
            fastcgi_param SERVER_PORT $server_port;
            fastcgi_param SERVER_NAME $server_name;
            fastcgi_pass_header Authorization;
            fastcgi_intercept_errors off;
        }
    }

 

fastcgi.py

from app import app
from flup.server.fcgi import WSGIServer

if __name__ == '__main__':
    WSGIServer(app,bindAddress=('127.0.0.1', 8008)).run()

启动python服务:

python fastcgi.py

启动Nginx:

测试一下,很完美!

 

posted on 2019-07-03 15:45  onlyou13  阅读(708)  评论(0编辑  收藏  举报