700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > python flask实战订餐系统微信小程序-60nginx + uwsgi 实现多进程访问

python flask实战订餐系统微信小程序-60nginx + uwsgi 实现多进程访问

时间:2023-04-17 13:39:08

相关推荐

python flask实战订餐系统微信小程序-60nginx + uwsgi 实现多进程访问

python flask实战订餐系统微信小程序-60nginx + uwsgi 实现多进程访问

B站配套视频教程观看

uwsgi多进程配置

uwsgi.ini配置

nginx和uwsgi通过配置文件sock配合

[uwsgi]#源码目录chdir=/home/www/order#python 虚拟环境home=/home/www/xuhssmodule=managercallable=appmaster=trueprocesses=4http=0.0.0.0:8889socket=/home/www/logs/order.sockbuffer-size=65535pidfile=/home/www/logs/order.pidchmod-socket=777logfile-chmod=644daemonize=/home/www/logs/order.logstatic-map = /static=/home/www/order/web/static

创建多进程

#激活虚拟环境source /home/www/xuhss/bin/activate# 创建log目录mkdir /home/www/logs# 启动uwsgicd /home/www/orderuwsgi --ini uwsgi.ini(多进程)

此时通过ps -ef | grep uwsgi,就可以看到多进程启动(注意:开发云主机的8889端口)

创建80端口访问

创建配置文件order.conf

cd /etc/nginx/conf.dtouch order.confvim order.conf

输入内容

https配置

server {listen 443 default_server;server_name ;ssl on;ssl_certificate /home/www/ssl/chained.pem;ssl_certificate_key /home/www/ssl/domain.key;ssl_session_timeout 5m;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA;ssl_session_cache shared:SSL:50m;location /.well-known/acme-challenge/ {alias /home/www/challenges/;try_files $uri =404;}location /static {alias /home/www/order/web/static/;}location / {try_files $uri @yourapplication;}location @yourapplication {include uwsgi_params;uwsgi_pass unix:/home/www/logs/order.sock;uwsgi_read_timeout 1800;uwsgi_send_timeout 300;}}server {listen 80;server_name ;rewrite ^/(.*) https://$server_name$request_uri? permanent;}

http配置

server {listen 80 default_server;server_name ;location /static {alias /home/www/order/web/static/;}location / {try_files $uri @yourapplication;}location @yourapplication {include uwsgi_params;uwsgi_pass unix:/home/www/logs/order.sock;uwsgi_read_timeout 1800;uwsgi_send_timeout 300;}}

启动nginx

service nginx startservice nginx stopps -ef | grep nginx

查看端口占用

netstat -ltunp

检查问题

nginx -c /etc/nginx/nginx.conf

强行关闭nginx

yum install -y psmiscfuser -n tcp 80kill -9 端口号

重启uwsgi

uwsgi --stop /home/www/logs/order.pid

出现500错误

setenforce 0

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。