Apache HTTP:在k8s中配置上下文路径

时间:2019-02-11 08:24:34

标签: apache http kubernetes

我有以下Apache配置:

WSGIPythonPath /var/www/server
WSGIPAssAuthorization On

<VirtualHost *:80>

    DocumentRoot /var/www/client/dist
    DirectoryIndex index.html

    ProxyPass        "/api/" "http://localhost:5000/api/"
    ProxyPassReverse "/api/" "http://localhost:5000/api/"

    <Directory /var/www/client/dist>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

</VirtualHost>

Listen 5000

<VirtualHost *:5000>

    WSGIDaemonProcess application threads=5
    WSGIScriptAlias / /var/www/server/wsgi.py
    WSGIProcessGroup application

    Alias /static/ /var/www/server/static

    <Directory /var/www/server>
        <Files wsgi.py>
            Order allow,deny
            Allow from all
        </Files>
    </Directory>

</VirtualHost>

它在docker / k8s环境中运行。而且该配置有1个问题:

  

当我将其部署到相对于根的某个路径(更新上下文路径)时,例如/some/path,它将所有请求重定向到/根URL。所有文件/脚本/样式都是从/而不是/some/path加载的。

所以,问题是如何修复配置以使其支持不同的上下文路径,例如由k8s入口控制器配置?

0 个答案:

没有答案