-
Notifications
You must be signed in to change notification settings - Fork 0
/
apache.conf
147 lines (121 loc) · 6.01 KB
/
apache.conf
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
ServerTokens Prod
<VirtualHost *:80>
# Default virtual server
ServerSignature Off
AddDefaultCharset UTF-8
LogLevel error
ErrorLog /var/www/data_dir/logs/error.log
CustomLog /var/www/data_dir/logs/access.log combined
DocumentRoot /var/www/public
DirectoryIndex index.php index.html index.htm
ErrorDocument 404 /mapserver/web/40x.html
ErrorDocument 500 /mapserver/web/50x.html
ErrorDocument 502 /mapserver/web/50x.html
ErrorDocument 503 /mapserver/web/50x.html
ErrorDocument 504 /mapserver/web/50x.html
# Serve static files from public folder
<Directory /var/www/public/>
Options Indexes FollowSymLinks
Require all granted
# Disable .htaccess files to speed up requests
# If you enable this directive, please comment out the 2 mod_rewrite blocks below,
# because they are also included in the .htaccess files, for compatibility reasons.
AllowOverride None
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect all requests to /mapserver/web/
RewriteRule ^$ /mapserver/web/ [L,R=301]
</IfModule>
</Directory>
<Directory /var/www/public/mapserver/>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.+)$
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Serve virtual resources with index.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^rest/(.*)/?$ /mapserver/rest/index.php?$1 [QSA,END]
# Serve virtual resources with index.html
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^web/(.*)/?$ /mapserver/web/index.html [QSA,END]
# Redirect to client if url is empty
RewriteRule ^$ /mapserver/web/ [L,R=301]
</IfModule>
</Directory>
# Serve PHP scripts with PHP-FPM
<IfModule mod_proxy_fcgi.c>
<FilesMatch ".php[345]?$">
SetHandler "proxy:unix:/var/run/php/php8.3-fpm.sock|fcgi://127.0.0.1/"
</FilesMatch>
</IfModule>
# Serve pregenerated tiles with MapCache module
<IfModule mapcache_module>
MapCacheAlias /mapserver/cache/service "/var/www/data_dir/mapcache.xml"
<Location /mapserver/cache/service>
Require all granted
</Location>
</IfModule>
# Serve virtual resources with fastCGI
<IfModule mod_fcgid.c>
FcgidInitialEnv MAPSERVER_CONFIG_FILE "/var/www/data_dir/mapserver.conf"
FcgidInitialEnv MAPCACHE_CONFIG_FILE "/var/www/data_dir/mapcache.xml"
# FcgidMaxRequestsPerProcess 1000
# FcgidMinProcessesPerClass 1
# FcgidMaxProcessesPerClass 5
# FcgidBusyTimeout 300
# FcgidIdleTimeout 300
# FcgidIOTimeout 120
# Handle tile generation on cache miss (fallback when MapCache module not enabled)
<IfModule !mapcache_module>
ScriptAlias /mapserver/cache/service /usr/bin/mapcache.fcgi
<Location /mapserver/cache/service>
SetHandler fcgid-script
Require all granted
</Location>
</IfModule>
# Pass requests to MapServer (old-fashioned URL naming)
# ScriptAlias /cgi-bin/mapserv /usr/bin/mapserv
# <Location /cgi-bin/mapserv>
# SetHandler fcgid-script
# Require all granted
# </Location>
# Pass OGC Web Service requests to MapServer
<Location ~ ^/mapserver(?>/(?<ms_mapfile>(?!web|api|cache)[a-zA-Z0-9\-\_]+))?/(?<service>ows|wms|wfs|wcs)$>
ScriptAlias /usr/bin/mapserv
SetHandler fcgid-script
Require all granted
</Location>
# Pass OGC API requests to MapServer
<Location ~ ^/mapserver(?<path_info>/(?>(?!web|api|cache)[a-zA-Z0-9\-\_]+)/ogcapi(?>/.*|$))$>
ScriptAlias /usr/bin/mapserv%{env:MATCH_PATH_INFO}
SetHandler fcgid-script
Require all granted
</Location>
# Fix missing QUERY_STRING params
<IfModule mod_rewrite.c>
RewriteEngine On
# RewriteRule ^/mapserver/(ows)$ /cgi-bin/mapserv?map=default [PT,QSA,NS,END]
# RewriteRule ^/mapserver/(wms|wfs|wcs)$ /cgi-bin/mapserv?map=default&SERVICE=$1 [PT,QSA,NS,END]
# RewriteRule ^/mapserver/([a-zA-Z0-9\-\_]+)/(ows)$ /cgi-bin/mapserv?map=$1 [PT,QSA,NS,END]
# RewriteRule ^/mapserver/([a-zA-Z0-9\-\_]+)/(wms|wfs|wcs)$ /cgi-bin/mapserv?map=$1&SERVICE=$2 [PT,QSA,NS,END]
# RewriteRule ^/mapserver/(ogcapi)(.*)$ /cgi-bin/mapserv/default/$1$2 [L,R=301]
RewriteRule ^/mapserver/(ows)$ /mapserver/$1?map=default [PT,QSA,NS,END]
RewriteRule ^/mapserver/(wms|wfs|wcs)$ /mapserver/$1?map=default&SERVICE=$1 [PT,QSA,NS,END]
RewriteRule ^/mapserver/([a-zA-Z0-9\-\_]+)/(ows)$ /mapserver/$1/$2?map=$1 [PT,QSA,NS,END]
RewriteRule ^/mapserver/([a-zA-Z0-9\-\_]+)/(wms|wfs|wcs)$ /mapserver/$1/$2?map=$1&SERVICE=$2 [PT,QSA,NS,END]
RewriteRule ^/mapserver/(ogcapi)(.*)$ /mapserver/default/$1$2 [L,R=301]
</IfModule>
</IfModule>
# Proxying requests to an external GeoServer service
# <IfModule proxy_module>
# ProxyPass /geoserver/web/ !
# ProxyPass "/geoserver" "http://localhost:8080/geoserver"
# ProxyPassReverse "/geoserver" "http://localhost:8080/geoserver"
# ProxyRequests Off
# ProxyPreserveHost On
# </IfModule>
</VirtualHost>