portal-apache2.4.conf 3.42 KB
Newer Older
1 2 3 4
#====================================================================
# Apache configuration for LemonLDAP::NG Portal
#====================================================================

5 6 7 8
# 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

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

15
    # DocumentRoot (FCGI scripts)
16 17
    DocumentRoot __PORTALSITEDIR__
    <Directory __PORTALSITEDIR__>
Xavier Guimard's avatar
Xavier Guimard committed
18 19
        Require all granted
        Options +ExecCGI +FollowSymLinks
20
    </Directory>
21
    RewriteEngine On
22 23 24 25
    # 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$"
26 27
    RewriteCond "%{REQUEST_FILENAME}" "!^/(?:(?:static|javascript|favicon).*|.*\.fcgi)$"
    RewriteRule "^/(.+)$" "/index.fcgi/$1" [PT]
28

Xavier Guimard's avatar
Xavier Guimard committed
29
    # Note that Content-Security-Policy header is generated by portal itself
30
    <Files *.fcgi>
Xavier Guimard's avatar
Xavier Guimard committed
31
        SetHandler fcgid-script
Xavier Guimard's avatar
Xavier Guimard committed
32 33 34 35 36 37
        # 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]
38
        Options +ExecCGI
39
        header unset Lm-Remote-User
Xavier Guimard's avatar
Xavier Guimard committed
40 41
    </Files>

42 43 44
    # Uncomment this if status is enabled
    #FcgidInitialEnv LLNGSTATUSHOST 127.0.0.1:64321

45
    # Static files
46
    Alias /static/ __PORTALSTATICDIR__
47 48 49 50 51 52 53 54 55 56 57
    <Directory __PORTALSTATICDIR__>
        Require all granted
        Options +FollowSymLinks
    </Directory>
    <Location /static/>
        <IfModule mod_expires.c>
            ExpiresActive On
            ExpiresDefault "access plus 1 month"
        </IfModule>
    </Location>

58
    <IfModule mod_dir.c>
59
        DirectoryIndex index.fcgi index.html
60 61
    </IfModule>

62
    # REST/SOAP functions for sessions management (disabled by default)
63
    <Location /index.fcgi/adminSessions>
Xavier Guimard's avatar
Xavier Guimard committed
64
        Require all denied
65 66
    </Location>

67
    # REST/SOAP functions for sessions access (disabled by default)
68
    <Location /index.fcgi/sessions>
Xavier Guimard's avatar
Xavier Guimard committed
69
        Require all denied
70 71
    </Location>

72
    # REST/SOAP functions for configuration access (disabled by default)
73
    <Location /index.fcgi/config>
Xavier Guimard's avatar
Xavier Guimard committed
74
        Require all denied
75 76
    </Location>

77
    # REST/SOAP functions for notification insertion (disabled by default)
78
    <Location /index.fcgi/notification>
Xavier Guimard's avatar
Xavier Guimard committed
79
        Require all denied
80 81
    </Location>

82
    # Enabe compression
83 84
    <Location />
        <IfModule mod_deflate.c>
Xavier Guimard's avatar
Xavier Guimard committed
85 86 87 88 89 90
                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
91 92
        </IfModule>
        <IfModule mod_headers.c>
Xavier Guimard's avatar
Xavier Guimard committed
93
                Header append Vary User-Agent env=!dont-vary
94 95
        </IfModule>
    </Location>
96 97 98

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