I'm using apache on my personal server, and I'm trying to run a 'main' website made with Silex
on www.mydomain.com/
and another one made using Flask
on www.mydomain.com/something
To run the Flask
website I'm using mod_wsgi as explained on their official website (http://flask.pocoo.org/docs/deploying/mod_wsgi/).
It works just fine, I can reach my website at www.mydomain.com/something
, but when I go back to www.mydomain.com/
I get a Flask
404 error message.
I've tried checking the apache
doc about virtual hosts but I can't make sense of it, here is my current 'sites-enabled/defaults'
configuration file :
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess bc user=bc group=bc threads=5
WSGIScriptAlias / /var/www/bc/bc.wsgi
<Directory /var/www/bc>
WSGIProcessGroup bc
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
my /var/www
directory looks like this :
./index.php
./bc/
./bc/index.py
How can I get the python website to only work in www.mydomain.com/something and let the PHP one run on www.mydomain.com/ ?
The first parameter to WSGIScriptAlias
is the url path, by specifying WSGIScriptAlias / <foo>
you're telling apache to send all requests to the WSGI app. Try WSGIScriptAlias /something <foo>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With