server { listen 80 default_server; #你的域名 server_name tt.com; #静态文件目录 root /www/wwwroot/www.tt.com; index index.html index.htm; #vue刷新404 location / { try_files $uri $uri/ @router; index index.html; } location @router { rewrite ^.*$ /index.html last; } #swagger文档访问配置 location ~* ^(/v2|/webjars|/swagger-resources|/swagger-ui.html) { proxy_pass http://127.0.0.1:8002; #index index.html index.htm; client_max_body_size 300m; } #接口配置文档 访问以/admin开头的会去8002端口 location /admin { proxy_pass http://127.0.0.1:8002; #index index.html index.htm; client_max_body_size 300m; } #接口配置文档 访问以/requestFenceData开头的会去8002端口 location /requestFenceData { proxy_pass http://127.0.0.1:8002; #index index.html index.htm; client_max_body_size 300m; } #禁止访问的文件或目录 location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md) { return 404; } access_log /www/wwwlogs/www.tt.com.log; error_log /www/wwwlogs/www.tt.com.error.log; }