Uwsgi PIP install uwsgi install uwsgi PIP install uwsgi

[uwsgi]
# uWSGi startup address and port (can be inconsistent with the project port)
socket = 127.0. 01.:5000
# Your project directory
chdir=/root/spider/byt
# Python startup file
wsgi-file = flsk.py
The name of the application variable used to start a Python program
callable = app
# number of processors
processes = 4
# threads
threads = 2
# buffer
buffer-size = 32768
State check address
stats = 127.0. 01.:9191
Copy the code

Nginx configure nginx.conf in /etc/nginx


user  root;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/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"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush on;

    keepalive_timeout 1200;
    client_max_body_size 200m;

    gzip  on;

    include /etc/nginx/conf.d/*.conf;
    server {
         listen          80;
         server_name     zbt.zebra-c.com;
         location / {
                include uwsgi_params;
                uwsgi_pass 127.0. 01.:5000; Keep the same socket configuration as in your UWSGi
                uwsgi_param UWSGI_PYHOME /usr/bin/python27.;# Your Python path
                uwsgi_param UWSGI_CHDIR /root/spider/bytedance;# you need the file path
                uwsgi_param UWSGI_SCRIPT flsk:app;You need a startup name for example if you're in a FLSK file and you're using the app}}}Copy the code

After configuring nginx, Ini uwsGi uWSgi –ini uwsgiconfig.ini –daemonize myblog.out