2021-11-15 22:24:54 +08:00
|
|
|
user root;
|
|
|
|
worker_processes 1;
|
|
|
|
|
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
http {
|
|
|
|
include mime.types;
|
|
|
|
default_type application/octet-stream;
|
|
|
|
sendfile on;
|
|
|
|
keepalive_timeout 65;
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 8980;
|
2021-11-16 10:44:07 +08:00
|
|
|
server_name 127.0.0.1;
|
|
|
|
client_max_body_size 200m;
|
2021-11-15 22:24:54 +08:00
|
|
|
|
2021-11-16 14:54:50 +08:00
|
|
|
root /usr/local/web;
|
|
|
|
index index.html;
|
|
|
|
|
2021-11-15 22:24:54 +08:00
|
|
|
location / {
|
2021-11-16 14:54:50 +08:00
|
|
|
# 此处的 @router 实际上是引用下面的转发,否则在 Vue 路由刷新时可能会抛出 404
|
|
|
|
try_files $uri $uri/ @router;
|
|
|
|
# 请求指向的首页
|
|
|
|
index index.html;
|
|
|
|
}
|
|
|
|
|
|
|
|
# 由于路由的资源不一定是真实的路径,无法找到具体文件
|
|
|
|
# 所以需要将请求重写到 index.html 中,然后交给真正的 Vue 路由处理请求资源
|
|
|
|
location @router {
|
|
|
|
rewrite ^.*$ /index.html last;
|
2021-11-15 22:24:54 +08:00
|
|
|
}
|
|
|
|
|
2021-11-16 14:54:50 +08:00
|
|
|
location /week/ {
|
|
|
|
proxy_pass http://10.25.17.26:8981/;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
add_header Set-Cookie "Secure";
|
|
|
|
proxy_cookie_path / "/; httponly; secure; SameSite=Strict";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-11-15 22:24:54 +08:00
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
|
|
location = /50x.html {
|
|
|
|
root html;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|