flask + gunicorn + pipenv + supervisor + nginx

flask + gunicorn + pipenv + supervisor + nginx


# gunicorn +  pipenv + supervisor + flask

[program:diudiudiu]
command=pipenv run gunicorn --workers=4 --bind=0.0.0.0:3601 server:app

directory=/root/diudiudiu

autostart=true
autorestart=false
stopsignal=QUIT
stopasgroup=true
killasgroup=true

user=root

redirect_stderr=true

#Log file path you can customize
stdout_logfile=/root/logs/diudiu_supervisor.log
logfile_backups=10
logfile_maxbytes=50MB

[supervisord]
environment=LC_ALL='en_US.UTF-8',LANG='en_US.UTF-8'


# nginx

server {

  listen 80;

  server_name xxx;

  location /api/ {
        # proxy_redirect  off;
        proxy_pass        http://127.0.0.1:3601;
        # To run properly, rewrite the request header
        proxy_set_header    Host                $host;
        proxy_set_header    X-Real-IP           $remote_addr;
        proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto   $scheme;
  }
}

 

你可能感兴趣的:(运维)