nginx配置+uwsgi+负载均衡配置
程序员文章站
2023-03-11 09:57:57
nginx静态文件配置 nginx + 反向代理 + runserver nginx + uwsgi启动 nginx + 负载均衡 ......
nginx静态文件配置
location /static{ alias /var/www/myApp/static; } sudo mkdir -vp /var/www/myApp/static/ sudo chmod 777 /var/www/myApp/static/ #工程目录settings下配置静态文件 STATIC_ROOT = '/var/www/myApp/static' STATIC_URL = '/static/' #迁移静态文件 python manage.py collectstatic #settings目录中 DEBUG = Flase ALLOW_HOST = ['*']
nginx + 反向代理 + runserver
location / { proxy_pass http://www.pipixia957.cn:8000; #反向代理设置 proxy_set_header X-real-ip $remote_addr; proxy_set_header Host $http_host; } [uwsgi] http=0.0.0.0:8000 chdir=/home/ubuntu/pro/project wsgi-file=project/wsgi.py processes=2 threads=2 master=True pidfile=uwsgi.pid daemonize=uwsgi.log runserver启动 #访问不需要加端口
nginx + uwsgi启动
location / { include uwsgi_params; uwsgi_pass www.pipixia957.cn:8000; } [uwsgi] socket=0.0.0.0:8000 chdir=/home/ubuntu/pro/project wsgi-file=project/wsgi.py processes=2 threads=2 master=True pidfile=uwsgi.pid daemonize=uwsgi.log #访问不需要再加端口
nginx + 负载均衡
upstream mycom{ ip_hash; server 10.11.0.1:8000; #负载均衡服务器群 server 10.11.0.1:8000; server 10.11.0.1:8000 down; } location / { include uwsgi_params; uwsgi_pass mycom; #连接负载均衡服务器 }
推荐阅读
-
Linux VPS上配置Nginx反向代理的方法
-
Laravel 5.5官方推荐的Nginx配置学习教程
-
在CentOS上配置Nginx+Gunicorn+Python+Flask环境的教程
-
详解利用nginx和docker实现一个简易的负载均衡
-
Nginx DNS resolver配置实例
-
分析nginx日志并屏蔽采集者ip(nginx屏蔽ip配置实例)
-
nginx跨域解决方案(教你nginx如何配置跨域)
-
nginx配置反向代理和负载均衡(nginx功能介绍和使用)
-
在阿里云服务器上配置CentOS+Nginx+Python+Flask环境
-
nginx配置反向代理和负载均衡(nginx功能介绍和使用)