标签:supervisor gunicron flask server nginx proxy home maj
supervisor apt安装
配置文件
nginx(
[program:nginx]
command = /usr/sbin/nginx -g 'daemon off;'
startsecs=0
autostart=true
autorestart=true
stdout_logfile=/home/maj/flask/log/nginx_sup.log
redirect_stderr=true
priority=10
stopasgroup=true
killasgroup=true
stopsignal=INT
startsecs=10
startretries=10
)
gunicron(
[program:gunicorn]
command=/home/maj/flask/venv/bin/gunicorn -w4 -b0.0.0.0:8000 app:app ; supervisor启动命令
directory=/home/maj/flask ; 项目的文件夹路径
startsecs=0 ; 启动时间
stopwaitsecs=0 ; 终止等待时间
autostart=true ; 是否自动启动
autorestart=true
stopasgroup=true ; 是否自动重启
stdout_logfile=/home/maj/flask/log/gunicorn.log ; log 日志
stderr_logfile=/home/maj/flask/log/gunicorn.err
environment=MAIL_USERNAME="xxx",MAIL_PASSWORD="xxx",SECRET_KEY="xxx"
)
nginx配置文件:
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /home/maj/flask;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/templates/index.html$is_args$query_string;
proxy_pass http://0.0.0.0:8000/;
proxy_set_header Host $proxy_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /static {
# root /static;
alias /home/maj/flask/static;
}
标签:supervisor,gunicron,flask,server,nginx,proxy,home,maj 来源: https://www.cnblogs.com/do-ma/p/16095957.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。