安装 uwsgi
pip install uwsgi -I --no-cache-dir
配置 uwsgi.ini
[uwsgi]
basedir = /home/admin
chdir = %(basedir)/zqxt
venv = %(basedir)/.envs/zqxt/
touch-reload = /home/admin/zqxt/manage.py
static-map = /static=/home/admin/zqxt/static
static-map = /media=/home/admin/zqxt/media
route = /([^/]+)\.(htm|html|txt)$ static:/home/admin/zqxt/$1.$2
http-socket = 127.0.0.1:7001
wsgi-file = zqxt/wsgi.py
thunder-lock = true
processes = 2
enable-threads = true
master = true
vacuum = true
buffer-size = 65535
;stats = 0.0.0.0:5000
Caddyfile
qiangsuo.com {
redir https://www.qiangsuo.com{uri} permanent
}
www.qiangsuo.com {
encode gzip
reverse_proxy http://127.0.0.1:7001
}
如果想用 caddy 来处理静态文件,可以使用
www.qiangsuo.com {
encode gzip
root * /home/admin/zqxt/
@notStatic {
not path /static/* /media/*
}
reverse_proxy @notStatic http://127.0.0.1:7001
file_server
}