请问大家,访问api.com/v1时,想让请求都请求到/www/api/v1下面,应该怎么配置?
server_name后面加path路径的,不懂怎么配置,求指点
<code>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;
}
</code>请问大家,访问api.com/v1时,想让请求都请求到/www/api/v1下面,应该怎么配置?
server_name后面加path路径的,不懂怎么配置,求指点
<code>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;
}
</code>
<code>location /v1/ {
alias /www/api/v1/; # 结尾的 / 需要加上,不然路径解析会被翻译成 www.api.com/v1/v1
}
</code>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号