首页 > 其他 > 详细

nginx子路径下反代运行django

时间:2021-05-31 22:03:29      阅读:30      评论:0      收藏:0      [点我收藏+]

方案一

uWSGI config:

[uwsgi]
# Requires PCRE support compiled into uWSGI
route-run = fixpathinfo:

Nginx config:

server {
    location /subpath/static {
        alias /srv/subpath/static;
    }

    location /subpath {
        uwsgi_pass unix://var/run/uwsgi.socket;
        uwsgi_param SCRIPT_NAME /subpath; # Pass the URL prefix to uWSGI so the "fixpathinfo:" route-rule can strip it out
        include uwsgi_params;
    }
}

方案二

在 settings.py 里,增加以下参数:

FORCE_SCRIPT_NAME = ‘/subpath‘

Reference Link

nginx子路径下反代运行django

原文:https://www.cnblogs.com/jonnyan/p/14832643.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!