portal-apache2.conf 2.98 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
#====================================================================
# Apache configuration for LemonLDAP::NG Portal
#====================================================================

# Uncomment this if no previous NameVirtualHost declaration
#NameVirtualHost __VHOSTLISTEN__

# Portal Virtual Host (auth.__DNSDOMAIN__)
<VirtualHost __VHOSTLISTEN__>
    ServerName auth.__DNSDOMAIN__

12
    # DocumentRoot (FCGI scripts)
13 14
    DocumentRoot __PORTALSITEDIR__
    <Directory __PORTALSITEDIR__>
Xavier Guimard's avatar
Xavier Guimard committed
15 16 17
        Order allow,deny
        Allow from all
        Options +ExecCGI +FollowSymLinks
18
    </Directory>
19
    RewriteEngine On
20 21 22 23
    # For performances, you can put static html files: simply put the HTML
    # result (example: /oauth2/checksession.html) as static file. Then
    # uncomment the following line.
    # RewriteCond "%{REQUEST_FILENAME}" "!\.html$"
24 25
    RewriteCond "%{REQUEST_FILENAME}" "!^/(?:(?:static|javascript|favicon).*|.*\.fcgi)$"
    RewriteRule "^/(.+)$" "/index.fcgi/$1" [PT]
26

Xavier Guimard's avatar
Xavier Guimard committed
27
    # Note that Content-Security-Policy header is generated by portal itself
28
    <Files *.fcgi>
Xavier Guimard's avatar
Xavier Guimard committed
29
        SetHandler fcgid-script
30 31
        #CGIPassAuth on
        Options +ExecCGI
Xavier Guimard's avatar
Xavier Guimard committed
32 33
    </Files>

34 35 36 37 38 39 40 41 42 43 44 45 46 47
    # Static files
    Alias /static/ __PORTALSTATICDIR__/
    <Directory __PORTALSTATICDIR__>
        Order allow,deny
        Allow from all
        Options +FollowSymLinks
    </Directory>
    <Location /static/>
        <IfModule mod_expires.c>
            ExpiresActive On
            ExpiresDefault "access plus 1 month"
        </IfModule>
    </Location>

48
    <IfModule mod_dir.c>
49
        DirectoryIndex index.fcgi index.html
50 51 52
    </IfModule>

    # SOAP functions for sessions management (disabled by default)
53
    <Location /index.fcgi/adminSessions>
Xavier Guimard's avatar
Xavier Guimard committed
54 55
        Order deny,allow
        Deny from all
56
    </Location>
57 58

    # SOAP functions for sessions access (disabled by default)
59
    <Location /index.fcgi/sessions>
Xavier Guimard's avatar
Xavier Guimard committed
60 61
        Order deny,allow
        Deny from all
62
    </Location>
63 64

    # SOAP functions for configuration access (disabled by default)
65
    <Location /index.fcgi/config>
Xavier Guimard's avatar
Xavier Guimard committed
66 67
        Order deny,allow
        Deny from all
68
    </Location>
69 70

    # SOAP functions for notification insertion (disabled by default)
71
    <Location /index.fcgi/notification>
Xavier Guimard's avatar
Xavier Guimard committed
72 73
        Order deny,allow
        Deny from all
74
    </Location>
75

76
    # Enabe compression
77 78
    <Location />
        <IfModule mod_deflate.c>
Xavier Guimard's avatar
Xavier Guimard committed
79 80 81 82 83 84
                AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css
                SetOutputFilter DEFLATE
                BrowserMatch ^Mozilla/4 gzip-only-text/html
                BrowserMatch ^Mozilla/4\.0[678] no-gzip
                BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
                SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
85 86
        </IfModule>
        <IfModule mod_headers.c>
Xavier Guimard's avatar
Xavier Guimard committed
87
                Header append Vary User-Agent env=!dont-vary
88 89
        </IfModule>
    </Location>
90 91 92

    # Uncomment this if site if you use SSL only
    #Header set Strict-Transport-Security 15768000
93 94
</VirtualHost>