apache2/httpd,静态/动态转发问题。

希望实现访问https://127.0.0.1:8443, 能够默认找到/var/www/static_web下的index.htm页面,
同时https://127.0.0.1:8443/api/v1/account/能够直接转发到/api/v1/account/

如果是以下配置:

Listen 8443

<VirtualHost *:8443>
WSGIDaemonProcess admin processes=2 threads=15 display-name=admin python-home=/path/to/env/env_dir python-path=/path/to/project
WSGIProcessGroup admin

DocumentRoot   "/var/www/static_web"
DirectoryIndex  index.htm

WSGIScriptAlias / "/path/to/wsgi.py"

Alias /media  "/path/to/media/"

WSGIScriptAlias / "/path/to/wsgi.py"将会把DocumentRoot "/var/www/static_web"对于根目录转发的配置覆盖,即:访问https://127.0.0.1:8443并不能找到根目录/var/www/static_web下的index.htm页面。
而是通过指定的django 服务/path/to/wsgi.py处理,如果urlpatterns中没有添加[re_path(r'^$', static.serve, {'path': 'index.htm', 'document_root': settings.STATIC_ROOT}),]匹配/的方法,那么访问https://127.0.0.1:8443会返回404。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值