django+uwsgi+nginx部署实现负载均衡

在项目的文件夹下新建文件blog1.py文件

[uwsgi]
http =:8089
chdir = /home/student/project/newsite/
wsgi-file = /home/student/project/newsite/newsite/wsgi.py
processes = 4
threads = 2
stats = 127.0.0.1:9191

启动uwsgi ———>uwsgi --ini blog.ini

在/etc/nginx/conf.d 文件夹中建立一个以.conf结尾的文件 blog.conf

upstream backend {
    server 127.0.0.1:8089;
    server 10.0.167.200:8090;
}
server {
// 定义监听端口号
    listen  8094;
    server_name localhost www.yoyo.com;
    charset UTF-8;
    access_log  /home/student/project/newsite_access.log;
    error_log   /home/student/project/newsite_error.log;

    client_max_body_size 75M;

    location / {
        proxy_pass http://backend;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容