Search code examples
apachemod-wsgimod-alias

Acache: wsgi and alias incompatibility


I am trying to setup Apache so that:

  • if the user goes to /temp then the file /home/temp/public_html/index.html is served
  • if the user goes to /temp/app then my mod-wsgi /home/temp/app/start.wsgi is executed

I currently have this:

<VirtualHost *:80>
    WSGIDaemonProcess temp user=temp group=temp home=/home/temp/app
    WSGIScriptAlias /temp/app /home/temp/app/start.wsgi
    Alias /temp /home/temp/public_html

    <Directory /home/temp/app>
        WSGIProcessGroup temp
        WSGIApplicationGroup %{GLOBAL}
        Require all granted
    </Directory>
</VirtualHost *:80>

But oddly enough Alias seems to take predence over WSGIScriptAlias and /temp/app does not work...


Solution

  • You got closer in your own answer, but not quite. Use something like:

    <VirtualHost *:80>
        WSGIDaemonProcess temp user=temp group=temp home=/home/temp/app
        Alias /temp/app /home/temp/app/start.wsgi
        Alias /temp /home/temp/public_html
    
        <Directory /home/temp/app>
            WSGIProcessGroup temp
            WSGIApplicationGroup %{GLOBAL}
            Require all granted
    
            Options ExecCGI
            AddHandler wsgi-script .wsgi
        </Directory>
    </VirtualHost>