1.调试路径匹配,手动返回结果测试
location /static {
return 200 "I am static!";
}
2.打印详细调试日志
http {
server{
#debug 为日志级别
error_log 日志文件路径 debug;
}
}
3.代理中相对路径,绝对路径区别
location /proxy {
proxy_pass http://192.168.137.181:8080/;
}
绝对路径会去掉匹配的前缀"/proxy"
访问 http://127.0.0.1/proxy/test/test.txt
转发 http://192.168.137.181:8080/test/test.txt
location /proxy {
proxy_pass http://192.168.137.181:8080;
}
绝对路径不会去掉匹配的前缀"/proxy"
访问 http://127.0.0.1/proxy/test/test.txt
转发 http://192.168.137.181:8080/proxy/test/test.txt