淘先锋技术网

首页 1 2 3 4 5 6 7
  • 安装uwsgi

    yum install python-devel
    pip install uWSGI
    
  • 使用uwsgi启动flask项目

  • 安装nginx

    yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
    wget http://nginx.org/download/nginx-1.14.2.tar.gz
    tar zxvf nginx-1.14.2.tar.gz
    cd nginx-1.14.2/
    ./configure
    make && make install
    
  • 使用nginx部署

    user root;
    worker_processes auto;
    error_log /tmp/logs/nginx.log;
    pid /tmp/logs/nginx.pid;
    
    events {
        worker_connections  1024;
    }
    
    http {
        include    /usr/local/nginx/conf/mime.types;
        default_type    application/octet-stream;
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
    
        sendfile on;
        keepalive_timeout   65;
    
        upstream backend {
            server xxx.xxx.xxx.xxx max_fails=2 fail_timeout=30s;
            server xxx.xxx.xxx.xxx max_fails=2 fail_timeout=30s;
        }
    
        server {
            listen    8080;
            server_name    127.0.0.1;
            location / {
                include    /usr/local/nginx/conf/uwsgi_params;
                uwsgi_pass   backend;
            }
    
        }
    }