- 配置多個站點,配置多個location
server {
listen 80;
location /spring {
root /data_prod/webapp/spring;
index index.html;
}
location / {
root /data_prod/webapp/lamp-web-pro-datasource/dist;
index index.html;
}
}
配置完以后訪問。http://xxxx/spring提示404
- 將具有具體路徑的站點,將root修改為使用alias配置
server {
listen 80;
location /spring {
alias /data_prod/webapp/spring;
index index.html;
}
location / {
root /data_prod/webapp/lamp-web-pro-datasource/dist;
index index.html;
}
}
改動后即可以使用了;
- 具體root 和 alias 的區(qū)別:Nginx配置中:root和alias區(qū)別 - 簡書 (jianshu.com)