#====================================================================
# Nginx configuration for LemonLDAP::NG sample applications
#====================================================================

# Sample reverse-proxy virtualhost
server {
    listen __VHOSTLISTEN__;
    server_name test1.__DNSDOMAIN__;

    location / {
        # Prepare user data transmission to protected HTTP app
        include lemonldap-ng/http-accounting;

        # Trigger Lemonldap::NG access control
        include lemonldap-ng/access-control;

        # Transfer request to backend
        proxy_pass http://target.__DNSDOMAIN__/;
    }

    #access_log /var/log/nginx/access.log lm_combined;
}

# Sample FastCGI application
server {
    listen __VHOSTLISTEN__;
    server_name test2.__DNSDOMAIN__;

    location / {
        # Prepare user data transmission to protected FastCGI app
        include lemonldap-ng/fcgi-accounting;

        # Trigger Lemonldap::NG access control
        include lemonldap-ng/access-control;

        # Transfer request to backend - assume fcgiwrap is installed
        root __TESTDIR__;
        try_files $uri $uri/index.pl;
        include fastcgi_params;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
    }

    #access_log /var/log/nginx/access.log lm_combined;
}
