103 lines
3.1 KiB
Plaintext
103 lines
3.1 KiB
Plaintext
# Live Trail (front controller in public/) and Geo (WMTS cache service).
|
|
# Both share port 80 and are told apart by host name; *.localhost resolves to
|
|
# 127.0.0.1 in browsers and curl without touching /etc/hosts.
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name livetrail.localhost;
|
|
|
|
root /var/www/html/livetrail/public;
|
|
index index.php;
|
|
|
|
# Matches post_max_size / upload_max_filesize in php.ini
|
|
client_max_body_size 4G;
|
|
|
|
# Compression (text/html is always compressed once gzip is on). Already
|
|
# compressed formats (images, woff/woff2, video, zip) are left out.
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_proxied any;
|
|
gzip_comp_level 5;
|
|
gzip_min_length 256;
|
|
gzip_types
|
|
text/plain
|
|
text/css
|
|
text/xml
|
|
text/javascript
|
|
application/javascript
|
|
application/json
|
|
application/geo+json
|
|
application/manifest+json
|
|
application/xml
|
|
application/gpx+xml
|
|
application/xhtml+xml
|
|
image/svg+xml
|
|
image/x-icon;
|
|
|
|
# Stock mime.types lacks these two, so they would be served as
|
|
# application/octet-stream and skipped by gzip_types.
|
|
include mime.types;
|
|
types {
|
|
application/geo+json geojson;
|
|
application/gpx+xml gpx;
|
|
}
|
|
|
|
# Serve pre-compressed file.ext.gz when it exists next to file.ext
|
|
# (no-op otherwise; needs ngx_http_gzip_static_module).
|
|
gzip_static on;
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.php$is_args$args;
|
|
}
|
|
|
|
location ~ \.php$ {
|
|
include snippets/fastcgi-php.conf;
|
|
fastcgi_pass unix:/run/php/php-fpm.sock;
|
|
|
|
# max_execution_time = 300
|
|
fastcgi_read_timeout 300;
|
|
}
|
|
|
|
# Never serve dotfiles (.git, .env, .vite manifest dir...)
|
|
location ~ /\.(?!well-known) {
|
|
deny all;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name 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 404.
|
|
root /var/www/html/geo;
|
|
|
|
location = /favicon.ico {
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# 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.
|
|
add_header Access-Control-Allow-Origin "http://livetrail.localhost" always;
|
|
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
|
|
add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With" always;
|
|
add_header Access-Control-Max-Age 86400 always;
|
|
|
|
location / {
|
|
# Preflight is answered here, without hitting PHP
|
|
if ($request_method = OPTIONS) {
|
|
return 204;
|
|
}
|
|
|
|
# Every request (?a=tile&id=...&x=..&y=..&z=..) goes through the front controller
|
|
include fastcgi.conf;
|
|
fastcgi_pass unix:/run/php/php-fpm.sock;
|
|
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
|
|
fastcgi_param SCRIPT_NAME /index.php;
|
|
fastcgi_read_timeout 300;
|
|
}
|
|
}
|