@cdmonkey
2019-08-06T09:43:12.000000Z
字数 943
阅读 730
Python
Django
创建 Django 用户:
useradd -s /sbin/nologin django
# 进入用户家目录,部署项目文件:
[root@PBSFINNGINX02 ~]# cd /home/django/
# uwsgi.ini
[uwsgi]
uid = django
gid = django
home = /home/django/.virtualenvs/JR-Nginx
chdir = /home/django/JR_Nginx
socket = /tmp/django.sock
processes = 2
master = true
vacuum = true
pidfile = /home/django/JR_Nginx/uwsgi.pid
wsgi-file = /home/django/JR_Nginx/JR_Nginx/wsgi.py
daemonize = /home/django/JR_Nginx/uwsgi.log
Nginx 配置文件:
server {
listen 80;
server_name nginx.vbillbank.com;
charset utf-8;
client_max_body_size 75M;
location /media {
alias /home/django/JR_Nginx/media;
}
location /static {
alias /home/django/JR_Nginx/static;
}
location / {
uwsgi_pass unix:///tmp/django.sock;
include uwsgi_params;
}
}
重新启动 uwsgi 服务:
# 首先进入虚拟场景:
[root@PBSFINNGINX02 ~]# workon JR-Nginx
# 进入项目根目录,然后杀掉进程:
(JR-Nginx) [root@PBSFINNGINX02 ~]# cd /home/django/JR_Nginx
(JR-Nginx) [root@PBSFINNGINX02 JR_Nginx]# kill -9 `cat uwsgi.pid`
# 再次启动服务:
(JR-Nginx) [root@PBSFINNGINX02 JR_Nginx]# uwsgi uwsgi.ini -b 40960
# 退出虚拟场景:
deactivate