NOTE: This question is different from 'Add a prefix to all Flask routes' as I am trying to resolve this at apache level. Additional, the suggested fix for flask routes did not work!
Following on from this post, I'm trying to set up apache to serve PHP files by default, but point a given alias (i.e. /flaskapp
) to a wsgi path. The wsgi file in turn routes requests to a python flask app.
Here's the apache config that I'm trying (under 000-default.conf
):
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost
Alias / /var/www/html/
<Directory "/var/www/html">
Order Deny,Allow
Allow from all
Require all granted
</Directory>
WSGIScriptAlias /flaskapp "/var/www/flaskapp/deploy.wsgi"
<Directory /var/www/flaskapp>
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
After doing a service apache2 restart
I find that requests to http://myip/flaskapp
result in a 404 error. Everything else works fine.
Things I've tried so far:
- Double checking all the file and folder paths (no issues found)
- Using the wsgi part of the above code to set up the wsgi app as a standalone virtualhost (works fine)
- Adding
app.config['APPLICATION_ROOT'] = '/flaskapp'
to my app.py file, as suggested the question 'Add a prefix to all Flask routes' (Didn't have any effect)
Where could I be going wrong?