nginx.conf 配置文件
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name 第一个域名;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:3309;
}
location /static {
alias /home/XXXXX(静态文件目录);
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name 第二个域名;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:3308;
}
location /static {
alias /home/XXXXX(静态文件目录);
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
nginx 关闭 开启 重载
sudo ./nginx -s stop
sudo ./nginx
sudo ./nginx -s reload
uwsgi.ini配置文件
[uwsgi]
# 配置nginx
socket = 127.0.0.1:3309
# 如果是配置第二个项目,改一下uwsgi的端口号即可
# socket = 127.0.0.1:3308
# 配置项目目录
chdir = /home/XXXXX(项目目录)
# 配置入口模块
wsgi-file = 项目名/wsgi.py
# 开启master, 将会多开一个管理进程, 管理其他服务进程
master = True
# 服务器开启的进程数量
processes = 2
# 服务器进程开启的线程数量
threads = 4
# 以守护进程方式提供服, 输出信息将会打印到log中
daemonize = wsgi.log
# 退出的时候清空环境变量
vacuum = true
# 进程pid
pidfile=uwsgi.pid
uwsgi 关闭 开启
sudo uwsgi --stop uwsgi.pid
sudo uwsgi --ini uwsgi.ini