uwsgi:
pip3 install uwsgi
这里可能会遇到报错
#有些是
yum remove openssl-devel
#有些是
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel psmisc libffi-devel tk-devel pcre-devel
自行尝试
命令参数:
[uwsgi]
socket = 127.0.0.1:8001
chdir = /root/day03/
wsgi-file = day03/wsgi.py
processes = 4
virtualenv = /envs/nb/
touch uwsgi_day03.ini
vim uwsgi_day03.ini
启动
uwsgi --ini uwsgi_day03.ini
后台运行:
uwsgi --ini uwsgi_day03.ini &
nginx:
yum install nginx -y
当然你也可以选择源码装
配置文件:
/etc/nginx/nginx.conf
启动:
systemctl start nginx
请自行配置
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http:///en/docs/ngx_core_module.html#include
# for more information.
# include /etc/nginx/conf.d/*.conf;
upstream django {
#这是uwsgi你自己定义的
server 127.0.0.1:8001;
}
server {
listen 80;
listen [::]:80;
#这里显示域名
server_name _;
# Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#自行配置
location /static {
alias /root/allstatic;
}
location / {
uwsgi_pass django;
include uwsgi_params;
}
}
}
备份:
vim nginx.conf
systemctl restart nginx
同时启动uwsgi:
uwsgi --ini uwsgi_day03.ini &
开机自启:
systemctl enable nginx