portal-apache2.X.conf 3.59 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__>
15 16 17 18 19 20 21 22 23
        <IfVersion >= 2.3>
            Require all granted
        </IfVersion>
        <IfVersion < 2.3>
            Order Deny,Allow
            Allow from all
        </IfVersion>
        Options +ExecCGI +FollowSymLinks
    </Directory>
24
    RewriteEngine On
25 26 27 28
    # 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$"
29 30
    RewriteCond "%{REQUEST_FILENAME}" "!^/(?:(?:static|javascript|favicon).*|.*\.fcgi)$"
    RewriteRule "^/(.+)$" "/index.fcgi/$1" [PT]
31

Xavier Guimard's avatar
Xavier Guimard committed
32
    # Note that Content-Security-Policy header is generated by portal itself
Xavier Guimard's avatar
Xavier Guimard committed
33
    <Files *.fcgi>
Xavier Guimard's avatar
Xavier Guimard committed
34 35 36 37
        SetHandler fcgid-script
	Options +ExecCGI
    </Files>

38 39 40 41 42 43 44 45 46 47 48 49 50
    # Static files
    Alias /static/ __PORTALSTATICDIR__/
    <Directory __PORTALSTATICDIR__>
        Require all granted
        Options +FollowSymLinks
    </Directory>
    <Location /static/>
        <IfModule mod_expires.c>
            ExpiresActive On
            ExpiresDefault "access plus 1 month"
        </IfModule>
    </Location>

51
    <IfModule mod_dir.c>
52
        DirectoryIndex index.fcgi index.html
53 54 55
    </IfModule>

    # SOAP functions for sessions management (disabled by default)
56
    <Location /index.fcgi/adminSessions>
57 58 59 60 61 62 63 64 65 66
        <IfVersion >= 2.3>
            Require all denied
        </IfVersion>
        <IfVersion < 2.3>
            Order Deny,Allow
            Deny from all
        </IfVersion>
    </Location>

    # SOAP functions for sessions access (disabled by default)
67
    <Location /index.fcgi/sessions>
68 69 70 71 72 73 74 75 76 77
        <IfVersion >= 2.3>
            Require all denied
        </IfVersion>
        <IfVersion < 2.3>
            Order Deny,Allow
            Deny from all
        </IfVersion>
    </Location>

    # SOAP functions for configuration access (disabled by default)
78
    <Location /index.fcgi/config>
79 80 81 82 83 84 85 86 87 88
        <IfVersion >= 2.3>
            Require all denied
        </IfVersion>
        <IfVersion < 2.3>
            Order Deny,Allow
            Deny from all
        </IfVersion>
    </Location>

    # SOAP functions for notification insertion (disabled by default)
89
    <Location /index.fcgi/notification>
90 91 92 93 94 95 96 97 98
        <IfVersion >= 2.3>
            Require all denied
        </IfVersion>
        <IfVersion < 2.3>
            Order Deny,Allow
            Deny from all
        </IfVersion>
    </Location>

99
    # Enabe compression
100 101 102 103 104 105 106 107 108 109 110 111 112
    <Location />
        <IfModule mod_deflate.c>
                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
        </IfModule>
        <IfModule mod_headers.c>
                Header append Vary User-Agent env=!dont-vary
        </IfModule>
    </Location>
113 114 115

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