portal-apache2.X.conf 4.27 KB
Newer Older
1 2 3 4 5 6 7
#====================================================================
# Apache configuration for LemonLDAP::NG Portal
#====================================================================

# Uncomment this if no previous NameVirtualHost declaration
#NameVirtualHost __VHOSTLISTEN__

8 9 10 11
# To insert LLNG user id in Apache logs, declare this format and use it in
# CustomLog directive
#LogFormat "%v:%p %h %l %{Lm-Remote-User}o %t \"%r\" %>s %O" llng

12 13 14
# Portal Virtual Host (auth.__DNSDOMAIN__)
<VirtualHost __VHOSTLISTEN__>
    ServerName auth.__DNSDOMAIN__
15
    # See above to set LLNG user id in Apache logs
16
    #CustomLog __APACHELOGDIR__/portal.log llng
17

18
    # DocumentRoot (FCGI scripts)
19 20
    DocumentRoot __PORTALSITEDIR__
    <Directory __PORTALSITEDIR__>
21 22 23 24 25 26 27 28 29
        <IfVersion >= 2.3>
            Require all granted
        </IfVersion>
        <IfVersion < 2.3>
            Order Deny,Allow
            Allow from all
        </IfVersion>
        Options +ExecCGI +FollowSymLinks
    </Directory>
30
    RewriteEngine On
31 32 33 34
    # 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$"
35 36
    RewriteCond "%{REQUEST_FILENAME}" "!^/(?:(?:static|javascript|favicon).*|.*\.fcgi)$"
    RewriteRule "^/(.+)$" "/index.fcgi/$1" [PT]
37

Xavier Guimard's avatar
Xavier Guimard committed
38
    # Note that Content-Security-Policy header is generated by portal itself
Xavier Guimard's avatar
Xavier Guimard committed
39
    <Files *.fcgi>
Xavier Guimard's avatar
Xavier Guimard committed
40
        SetHandler fcgid-script
Xavier Guimard's avatar
Xavier Guimard committed
41 42 43 44 45 46
        # For Authorization header to be passed, please uncomment one of the following:
        # for Apache >= 2.4.13
        #CGIPassAuth On
        # for Apache < 2.4.13
        #RewriteCond %{HTTP:Authorization} ^(.*)
        #RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
47
        Options +ExecCGI
48
        header unset Lm-Remote-User
Xavier Guimard's avatar
Xavier Guimard committed
49 50
    </Files>

51 52 53
    # Uncomment this if status is enabled
    #FcgidInitialEnv LLNGSTATUSHOST 127.0.0.1:64321

54
    # Static files
55
    Alias /static/ __PORTALSTATICDIR__
56 57 58 59 60 61 62 63 64 65 66
    <Directory __PORTALSTATICDIR__>
        Require all granted
        Options +FollowSymLinks
    </Directory>
    <Location /static/>
        <IfModule mod_expires.c>
            ExpiresActive On
            ExpiresDefault "access plus 1 month"
        </IfModule>
    </Location>

67
    <IfModule mod_dir.c>
68
        DirectoryIndex index.fcgi index.html
69 70
    </IfModule>

71
    # REST/SOAP functions for sessions management (disabled by default)
72
    <Location /index.fcgi/adminSessions>
73 74 75 76 77 78 79 80 81
        <IfVersion >= 2.3>
            Require all denied
        </IfVersion>
        <IfVersion < 2.3>
            Order Deny,Allow
            Deny from all
        </IfVersion>
    </Location>

82
    # REST/SOAP functions for sessions access (disabled by default)
83
    <Location /index.fcgi/sessions>
84 85 86 87 88 89 90 91 92
        <IfVersion >= 2.3>
            Require all denied
        </IfVersion>
        <IfVersion < 2.3>
            Order Deny,Allow
            Deny from all
        </IfVersion>
    </Location>

93
    # REST/SOAP functions for configuration access (disabled by default)
94
    <Location /index.fcgi/config>
95 96 97 98 99 100 101 102 103
        <IfVersion >= 2.3>
            Require all denied
        </IfVersion>
        <IfVersion < 2.3>
            Order Deny,Allow
            Deny from all
        </IfVersion>
    </Location>

104
    # REST/SOAP functions for notification insertion (disabled by default)
105
    <Location /index.fcgi/notification>
106 107 108 109 110 111 112 113 114
        <IfVersion >= 2.3>
            Require all denied
        </IfVersion>
        <IfVersion < 2.3>
            Order Deny,Allow
            Deny from all
        </IfVersion>
    </Location>

115
    # Enabe compression
116 117 118 119 120 121 122 123 124 125 126 127 128
    <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>
129 130 131

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