0

I am trying to serve one flask app directly at localhost, and another at localhost/menus.

When my apache configuration is like this:

<VirtualHost *:80>
ServerName localhost

# logs configuration -------------------------------------------------
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# front page ---------------------------------------------------------
WSGIDaemonProcess flask_ac user=#1000 group=#1000 threads=5
WSGIScriptAlias /front /var/www/flask_ac/hookup.wsgi

<Directory /var/www/flask_ac>
    WSGIProcessGroup flask_ac
    WSGIApplicationGroup flask_ac
    Require all granted
</Directory>

# start menus --------------------------------------------------------
WSGIDaemonProcess menus user=#1000 group=#1000 threads=5
WSGIScriptAlias /menus /var/www/flask_ac/projects/menus/hookup.wsgi

<Directory "/var/www/flask_ac/projects/menus/">
    WSGIProcessGroup menus
    WSGIApplicationGroup menus
    Require all granted
</Directory>

It works fine, but it is serving the first app at localhost/front instead of just localhost.

If I change my first WSGIScriptAlias to:

WSGIScriptAlias / /var/www/flask_ac/hookup.wsgi

It will serve the first app correctly at localhost, but the second app at localhost/menus breaks, and returns not found.

I found this answer about a similar issue, but it doesn't address this directly, and I cant seem to figure it out.

4

1 回答 1

0

更改顺序,使子 URL 的应用程序在前。

WSGIScriptAlias /menus /var/www/flask_ac/projects/menus/hookup.wsgi

...

WSGIScriptAlias / /var/www/flask_ac/hookup.wsgi

提及订购的文档:

于 2018-01-21T01:04:51.313 回答