This commit is contained in:
1 parent
56d8f46434
commit
f8d4ddb19c
4 files changed
+332
-188
No files matched your search
@@ -1,26 +1,10 @@
|
||||
<VirtualHost *:80>
|
||||
ServerName localhost
|
||||
ServerAlias maui.local
|
||||
ServerName livetrail.localhost
|
||||
DocumentRoot /var/www/html/
|
||||
|
||||
RewriteEngine on
|
||||
RewriteCond %{HTTPS} off
|
||||
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [END,NE,R=permanent]
|
||||
</VirtualHost>
|
||||
|
||||
<IfModule mod_ssl.c>
|
||||
<VirtualHost *:443>
|
||||
ServerName localhost
|
||||
ServerAlias maui.local
|
||||
DocumentRoot /var/www/html/
|
||||
|
||||
SSLCertificateFile /etc/letsencrypt/live/mushu.nest.lutran.ch/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/mushu.nest.lutran.ch/privkey.pem
|
||||
Include /etc/letsencrypt/options-ssl-apache.conf
|
||||
|
||||
DirectoryIndex index.php
|
||||
|
||||
# Serve https://localhost/livetrail/ from the public web root.
|
||||
# Serve http://livetrail.localhost/ from the public web root.
|
||||
Alias /livetrail /var/www/html/livetrail/public
|
||||
|
||||
<Directory /var/www/html/livetrail/public>
|
||||
@@ -67,4 +51,42 @@
|
||||
</IfModule>
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
</IfModule>
|
||||
|
||||
# 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>
|
||||
@@ -0,0 +1,102 @@
|
||||
# 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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user