实现以下效果:
http://127.0.0.1/home-web // 官网
http://127.0.0.1/app-web // 手机页面
http://127.0.0.1/admin-web // 后台管理页面
server {
listen 80;
server_name _;
#默认主页
location / {
root /opt/web/home-web/;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
#location /home-web 中的 home-web 为网站访问路径
location /home-web {
alias /opt/web/home-web/; # 使用alias方式,home-web 后面必须跟 “/”
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /app-web {
alias /opt/web/app-web/;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /admin-web {
alias /opt/web/admin-web/;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
}