85 lines
2.5 KiB
Plaintext
85 lines
2.5 KiB
Plaintext
# app.dev.lernschiff.com — Livewire SPA + Vite assets
|
|
server {
|
|
listen 80;
|
|
server_name app.dev.lernschiff.com;
|
|
root /var/www/html/public;
|
|
index index.php;
|
|
|
|
# Vite HMR WebSocket
|
|
location /vite-hmr {
|
|
proxy_pass http://vite:5173/vite-hmr;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
proxy_read_timeout 86400;
|
|
}
|
|
|
|
# Vite dev asset paths — prefix locations with ^~ to skip regex eval
|
|
location ^~ /resources/ {
|
|
proxy_pass http://vite:5173;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
location ^~ /node_modules/ {
|
|
proxy_pass http://vite:5173;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
location ~ ^/(@vite|@id|@fs|@react-refresh)/ {
|
|
proxy_pass http://vite:5173;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.php?$query_string;
|
|
}
|
|
|
|
location ~ \.php$ {
|
|
fastcgi_pass app:9000;
|
|
fastcgi_index index.php;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
include fastcgi_params;
|
|
}
|
|
|
|
location /storage {
|
|
alias /var/www/html/storage/app/public;
|
|
}
|
|
}
|
|
|
|
# api.dev.lernschiff.com — Laravel JSON API + CORS (Single-Source-of-Truth)
|
|
server {
|
|
listen 80;
|
|
server_name api.dev.lernschiff.com;
|
|
root /var/www/html/public;
|
|
index index.php;
|
|
|
|
# OPTIONS Preflight fast-path
|
|
location / {
|
|
if ($request_method = OPTIONS) {
|
|
add_header Access-Control-Allow-Origin "https://app.dev.lernschiff.com" always;
|
|
add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS" always;
|
|
add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-XSRF-TOKEN, X-Requested-With" always;
|
|
add_header Access-Control-Allow-Credentials "true" always;
|
|
add_header Access-Control-Max-Age 86400 always;
|
|
add_header Content-Length 0;
|
|
return 204;
|
|
}
|
|
|
|
add_header Access-Control-Allow-Origin "https://app.dev.lernschiff.com" always;
|
|
add_header Access-Control-Allow-Credentials "true" always;
|
|
|
|
try_files $uri $uri/ /index.php?$query_string;
|
|
}
|
|
|
|
location ~ \.php$ {
|
|
fastcgi_pass app:9000;
|
|
fastcgi_index index.php;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
include fastcgi_params;
|
|
}
|
|
}
|