93 lines
3.7 KiB
Plaintext
93 lines
3.7 KiB
Plaintext
<VirtualHost *:80>
|
|
ServerName livetrail.localhost
|
|
DocumentRoot /var/www/html/
|
|
|
|
DirectoryIndex index.php
|
|
|
|
# Serve http://livetrail.localhost/ from the public web root.
|
|
Alias /livetrail /var/www/html/livetrail/public
|
|
|
|
<Directory /var/www/html/livetrail/public>
|
|
Options FollowSymLinks
|
|
AllowOverride None
|
|
Require all granted
|
|
|
|
AddType application/geo+json .geojson
|
|
|
|
<IfModule mod_headers.c>
|
|
<FilesMatch "\.geojson$">
|
|
Header set Cache-Control "public, max-age=31536000, immutable"
|
|
</FilesMatch>
|
|
</IfModule>
|
|
|
|
<IfModule mod_brotli.c>
|
|
AddOutputFilterByType BROTLI_COMPRESS \
|
|
text/html \
|
|
text/plain \
|
|
text/css \
|
|
text/javascript \
|
|
text/xml \
|
|
application/javascript \
|
|
application/json \
|
|
application/geo+json \
|
|
application/manifest+json \
|
|
application/xml \
|
|
image/svg+xml
|
|
</IfModule>
|
|
|
|
<IfModule mod_deflate.c>
|
|
AddOutputFilterByType DEFLATE \
|
|
text/html \
|
|
text/plain \
|
|
text/css \
|
|
text/javascript \
|
|
text/xml \
|
|
application/javascript \
|
|
application/json \
|
|
application/geo+json \
|
|
application/manifest+json \
|
|
application/xml \
|
|
image/svg+xml
|
|
</IfModule>
|
|
</Directory>
|
|
</VirtualHost>
|
|
|
|
# Geo (WMTS cache service). Told apart from Live Trail by host name;
|
|
# *.localhost resolves to 127.0.0.1 without touching /etc/hosts.
|
|
# Needs: a2enmod rewrite headers proxy_fcgi setenvif
|
|
<VirtualHost *:80>
|
|
ServerName geo.localhost
|
|
|
|
# The project root also holds vendor/, config/settings.php, lib/ and .git,
|
|
# so only index.php and favicon.ico are reachable; everything else is
|
|
# rewritten to the front controller below.
|
|
DocumentRoot /var/www/html/geo
|
|
|
|
<Directory /var/www/html/geo>
|
|
Options FollowSymLinks
|
|
AllowOverride None
|
|
Require all granted
|
|
</Directory>
|
|
|
|
# CORS: Live Trail (browser) calls Geo cross-origin. "always" so the headers
|
|
# are also sent on 403/404/5xx, otherwise the browser reports a CORS error
|
|
# instead of the real status.
|
|
<IfModule mod_headers.c>
|
|
Header always set Access-Control-Allow-Origin "http://livetrail.localhost"
|
|
Header always set Access-Control-Allow-Methods "GET, POST, OPTIONS"
|
|
Header always set Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With"
|
|
Header always set Access-Control-Max-Age "86400"
|
|
</IfModule>
|
|
|
|
RewriteEngine on
|
|
|
|
# Preflight is answered here, without hitting PHP
|
|
RewriteCond %{REQUEST_METHOD} =OPTIONS
|
|
RewriteRule ^ - [R=204,END]
|
|
|
|
# Every request (?a=tile&id=...&x=..&y=..&z=..) goes through the front controller
|
|
RewriteCond %{REQUEST_URI} !=/favicon.ico
|
|
RewriteCond %{REQUEST_URI} !=/index.php
|
|
RewriteRule ^ /index.php [END,QSA]
|
|
</VirtualHost>
|