summaryrefslogtreecommitdiffstats
path: root/server/etc/apache.conf.tmpl
blob: 099d9ea5087848ec1be2304039c86b34a2b8ce1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# OpenGnsys Web Admin Console template configuration for Apache.

Alias /opengnsys CONSOLEDIR

# PHP-FPM configuration
<IfModule proxy_fcgi_module>
	<FilesMatch ".+\.ph(p[3457]?|t|tml)$">
		SetHandler "proxy:fcgi://127.0.0.1:9000"
	</FilesMatch>
</IfModule>

RewriteEngine On

# Redirect HTTP to HTTPS and default configuration.
<Directory CONSOLEDIR>
	RewriteCond %{HTTPS} !=on
	RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
	Require all granted
	Options -Indexes +FollowSymLinks
	DirectoryIndex index.php
	AddType octet/stream .pkg
</Directory>

Alias /opengnsys3 CONSOLEDIR3

# Redirect HTTP to HTTPS and default configuration.
<Directory CONSOLEDIR3>
        RewriteCond %{HTTPS} !=on
        RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
        Require all granted
        Options -Indexes +FollowSymLinks
        DirectoryIndex index.html index.php
        AddType octet/stream .pkg
</Directory>

# Redirect HTTP to HTTPS and RESTful configuration.
<Directory CONSOLEDIR3/backend/web>
        #RewriteBase /opengnsys3/rest/web
        #RewriteRule .? - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        #RewriteCond %{HTTPS} !=on
        #RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
        #RewriteCond %{REQUEST_FILENAME} !-f
        #RewriteRule ^ index.php [QSA,L]
        DirectoryIndex app.php

        <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
                RewriteRule ^(.*) - [E=BASE:%1]

                # Sets the HTTP_AUTHORIZATION header removed by apache
                RewriteCond %{HTTP:Authorization} .
                RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

                RewriteCond %{ENV:REDIRECT_STATUS} ^$
                RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

                RewriteCond %{REQUEST_FILENAME} -f
                RewriteRule .? - [L]

                # Rewrite all other queries to the front controller.
                RewriteRule .? %{ENV:BASE}/app.php [L]
        </IfModule>

        <IfModule !mod_rewrite.c>
                <IfModule mod_alias.c>
                        RedirectMatch 302 ^/$ /app.php/
                </IfModule>
        </IfModule>
</Directory>