# vim: ts=4 filetype=apache

## Sample vhost config file for Apache 2 and MoinMoin with HTTP basic auth

## Add `Include /path/to/this/file` in your Apache httpd.conf to activate
## this configuration (or place this file in the location specified by your
## distribution), and remember to install mod_wsgi and start Apache
## with "-D WSGI" if mod_wsgi is not already enabled

## For more information on mod_wsgi configuration directives, see
## https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives

## Listen to port 80 on all IPs
<VirtualHost *:80>
    ## Replace with the name of your server (eg. localhost or my.domain.tld)
    ServerName myservername

    ## Note that python-path is required when deploying using virtualenv so
    ## that the interpreter can find the necessary Python packages installed
    ## with MoinMoin
    WSGIDaemonProcess moinmoin-wsgi user=myuser
        python-path=/path/to/moin/moin/virtualenv/python/interpreter/site-packages

    ## The wiki will be accessible from myservername:80/wiki/root/url/ now
    WSGIScriptAlias /wiki/root/url /path/to/moin/moin/install/moinmoin.wsgi

    ## Let WSGI applications use HTTP authentication methods
    WSGIPassAuthorization On

    <Directory /path/to/moin/moin/install>
        ## HTTP basic auth
        ## Works with MoinMoin's GivenAuth authentication backend
        ## See https://httpd.apache.org/docs/2.0/howto/auth.html for more
        ## information on Apache authentication
        AuthType Basic

        ## Authname is the message that the browser will display when asking
        ## for username and password
        AuthName "Please log in"

        ## AuthUserFile contains usernames and passwords for wiki users
        ## and can be generated using the htpasswd utility included with
        ## Apache
        AuthUserFile /path/to/moin/apache/passwords/file

        ## valid-user means that the supplied username must be in AuthUserFile
        ## and the supplied password must match the entry for the user in
        ## AuthUserFile
        Require valid-user

        ## Name of the WSGI processes
        WSGIProcessGroup moinmoin-wsgi

        ## All WSGI applications in group %{GLOBAL} are run under the
        ## same interpreter for compatibility with the Global Interpreter
        ## Lock when using some C extensions
        WSGIApplicationGroup %{GLOBAL}

        Order deny,allow
        Allow from all
    </Directory>
</VirtualHost>

