安装Django:地址
安装uwsgi:地址
安装Nginx:地址
一、配置uwsgi
将uwsgi目录放至与发布项目同级目录下,创建uwsgi文件夹及uwsgi.ini文件,配置如下(可根据情况进行更改):
[uwsgi]
socket = 127.0.0.1:8001
master = true
workers = 2
reload-mercy = 10
vacuum = true
max-requests = 1000
limit-as = 512
buffer-size = 30000
daemonize = /var/log/uwsgi.log
pidfile = /tmp/uwsgi.pid
二、配置Nginx
编辑Nginx配置文件 /etc/nginx/conf.d/default.conf ,将根目录下添加以下内容:
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8001;
uwsgi_param UWSGI_SCRIPT one.wsgi;
uwsgi_param UWSGI_CHDIR /www/one/;
index index.html index.htm;
client_max_body_size 35m;
}
三、启动uwsgi以及Nginx
1. 启动uwsgi
uwsgi uwsgi.ini
2. 启动Nginx
service nginx start
四、项目测试
访问:http://192.168.129.4/index
注意事项:
1. 项目发布时,需要关闭SELINUX
2. 防火墙策略需要设置或关闭防火墙
评论区