# Nginx site configuration for the built admin SPA.
|
# Update the root path and TLS settings to match the deployment host.
|
server {
|
listen 80;
|
server_name mingdao123.com www.mingdao123.com;
|
|
root /var/www/tourguide/frontend/dist;
|
index index.html;
|
# Keep this at least as large as the backend multipart limit (5 MB).
|
client_max_body_size 6m;
|
|
# Keep API requests on the Spring Boot application.
|
location ^~ /api/ {
|
proxy_pass http://127.0.0.1:8011;
|
proxy_http_version 1.1;
|
proxy_set_header Host $host;
|
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
}
|
|
# User-uploaded files are also served by the backend.
|
location ^~ /uploads/ {
|
proxy_pass http://127.0.0.1:8011;
|
proxy_http_version 1.1;
|
proxy_set_header Host $host;
|
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
}
|
|
# Hashed Vite assets must be real files; do not return index.html for them.
|
location ^~ /assets/ {
|
try_files $uri =404;
|
access_log off;
|
add_header Cache-Control "public, immutable";
|
}
|
|
# Vue Router uses HTML5 history mode, so all client-side routes need the SPA entry.
|
location / {
|
try_files $uri $uri/ /index.html;
|
}
|
}
|