nginx配置如下:
location /day06api/ {
proxy_pass http://127.0.0.1:8080/;
}
实际访问的端口服务:http://127.0.0.1:8080/api/abc
location /day06api {
proxy_pass http://127.0.0.1:8080/;
}
实际访问的端口服务:http://127.0.0.1:8080//api/abc
location /day06api/ {
proxy_pass http://127.0.0.1:8080;
}
实际访问的端口服务:http://127.0.0.1:8080/day06api/api/abc
location /day06api {
proxy_pass http://127.0.0.1:8080;
}
实际访问的端口服务:http://127.0.0.1:8080/day06api/api/abc
location /day06api/ {
proxy_pass http://127.0.0.1:8080/server/;
}
实际访问的端口服务:http://127.0.0.1:8080/server/api/abc
location /day06api {
proxy_pass http://127.0.0.1:8080/server/;
}
实际访问的端口服务:http://127.0.0.1:8080/server//api/abc
ocation /day06api/ {
proxy_pass http://127.0.0.1:8080/server;
}
实际访问的端口服务:http://127.0.0.1:8080/serverapi/abc
location /day06api {
proxy_pass http://127.0.0.1:8080/server;
}
实际访问的端口服务:http://127.0.0.1:8080/server/api/abc
这个真的不好总结,可能总结的有误,可以直接对应上面的例子。
location /hello/{
root E:/project/;
index index.html;
}
实际请求资源路径
E:/project/hello/index.html
E:/project/hello/img/123.png
location /hello/{
root E:/project;
index index.html;
}
实际请求资源路径
E:/project/hello/index.html
E:/project/hello/img/123.png
location /hello{
root E:/project/;
index index.html;
}
实际请求资源路径
E:/project/hello/index.html
E:/project/hello/img/123.png
location /hello{
root E:/project;
index index.html;
}
实际请求资源路径
E:/project/hello/index.html
E:/project/hello/img/123.png
location /hello/{
alias E:/project/;
}
实际请求资源路径
E:/project/hello/index.html 404
E:/project/hello/img/123.png 正常
location /hello{
alias E:/project/;
}
实际请求资源路径
E:/project/hello/index.html 404
E:/project/hello/img/123.png 正常