nginx中一个server配置多个location

2024-05-05  本文已影响0人  zhihaoZzz
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

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;
        }

}

改动后即可以使用了;

上一篇 下一篇

猜你喜欢

热点阅读