时间:2021-07-01 10:21:17 帮助过:20人阅读
server {
listen 80;
server_name api.com www.api.com;
access_log /home/wwwlogs/access_nginx.log combined;
index index.html index.php;
location /v1/ {
root /www/api/v1;
}
请问大家,访问api.com/v1时,想让请求都请求到/www/api/v1下面,应该怎么配置?
server_name后面加path路径的,不懂怎么配置,求指点
server {
listen 80;
server_name api.com www.api.com;
access_log /home/wwwlogs/access_nginx.log combined;
index index.html index.php;
location /v1/ {
root /www/api/v1;
}
location /v1/ {
alias /www/api/v1/; # 结尾的 / 需要加上,不然路径解析会被翻译成 www.api.com/v1/v1
}