nginx 子目录配置
listen 81;
server_name 127.0.0.1;
#charset koi8-r;
#access_log logs/host.access.log main;
# add_header Access-Control-Allow-Origin *;
# add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
# add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
location / {
# root /Users/zhangdunke/Documents/project/yunji/yj_portal/build;
root /Users/zhangdunke/Documents/nginx/demo;
# root /Users/zhangdunke/Documents/vcanbuy/dist;
index index.html index.htm;
}
location /yj_portal{
try_files $uri $uri/ /yj_portal/index.html;
root /Users/zhangdunke/Documents/nginx/demo;
index index.html index.htm;
}
根目录:
location / {
try_files $uri $uri/ /index.html;
}