server {
listen 80;
server_name loc.tc.com m-loc.tc.com;
root /var/www/tc-front-api/public;
index index.php index.html index.htm;
#访问 http://loc.tc.com/enterprise/abc
# alias : 直接访问 1./var/www/test/dist/ + abc 2./var/www/test/dist/ + abc/ 3./var/www/test/dist/aaaa/index.html
#访问 http://host/enterprise/abc
# root : 直接访问 1./var/www/test/dist/ + /enterprise/abc 2./var/www/test/dist/ + /enterprise/abc/index.html 3./var/www/test/dist/aaaa/index.html
#nginx匹配location的try_files 和 index 索引文件,如果都找不到会使用外层的root + index
#优先级如下 location try_files > location index > server index
location ^~ /enterprise {
alias /var/www/test/dist;
try_files $uri $uri/ aaaa/index.html;
#index index.html;
}
access_log /var/log/nginx/test.com_access.log;
error_log /var/log/nginx/test.com_error.log;
}
nginx配置location相关信息
最新推荐文章于 2024-08-16 22:09:40 发布