添加服务器配置文件

This commit is contained in:
zhengxinonly
2022-03-30 20:54:30 +08:00
parent 1e34ef339a
commit 8760f21b03
4 changed files with 44 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
import os
import multiprocessing
bind = '0.0.0.0:8000'
backlog = 512
chdir = os.path.dirname(os.path.abspath(__file__))
timeout = 30
worker_class = 'sync'
workers = multiprocessing.cpu_count() * 2 + 1
threads = 2
loglevel = 'info'
access_log_format = '%(t)s %(p)s %(h)s "%(r)s" %(s)s %(L)s %(b)s %(f)s" "%(a)s"'
if not os.path.exists('logs'):
os.mkdir('logs')
accesslog = os.path.join(chdir, "logs/gunicorn_access.log")
errorlog = os.path.join(chdir, "logs/gunicorn_error.log")
+15
View File
@@ -0,0 +1,15 @@
server {
listen 80 default_server;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
proxy_pass http://127.0.0.1:8000; # 转发的地址,即Gunicorn运行的地址
proxy_redirect off;
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;
}
}
+7
View File
@@ -0,0 +1,7 @@
[program:pear]
command=bash /home/ubuntu/pear-admin-flask/start.sh
user=root
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
+3
View File
@@ -0,0 +1,3 @@
cd /home/ubuntu/pear-admin-flask
source venv/bin/activate
exec gunicorn -c gunicorn.conf.py "applications:create_app()"