liujie
2026-09-09 39f6fca28e3f78abe48f08e474ec011abb990b36
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 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;
    }
}