希望实现访问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。