其他
Nginx配置中一个不起眼字符"/"的巨大作用,失之毫厘谬以千里
location目录匹配详解
location /wddd/ {
proxy_connect_timeout 18000; ##修改成半个小时
proxy_send_timeout 18000;
proxy_read_timeout 18000;
proxy_pass http://127.0.0.1:8080;
}
proxy_pass有无“/”的四种区别探究
第一种:加"/"
location /wddd/ {
proxy_pass http://127.0.0.1:8080/;
}
第二种: 不加"/"
location /wddd/ {
proxy_pass http://127.0.0.1:8080;
}
第三种: 增加目录加"/"
location /wddd/ {
proxy_pass http://127.0.0.1:8080/sun/;
}
第四种:增加目录不加"/"
location /wddd/ {
proxy_pass http://127.0.0.1:8080/sun;
}
总结
server {
listen 80;
server_name localhost;
# http://localhost/wddd01/xxx -> http://localhost:8080/wddd01/xxx
location /wddd01/ {
proxy_pass http://localhost:8080;
}
# http://localhost/wddd02/xxx -> http://localhost:8080/xxx
location /wddd02/ {
proxy_pass http://localhost:8080/;
}
# http://localhost/wddd03/xxx -> http://localhost:8080/wddd03*/xxx
location /wddd03 {
proxy_pass http://localhost:8080;
}
# http://localhost/wddd04/xxx -> http://localhost:8080//xxx,请注意这里的双斜线,好好分析一下。
location /wddd04 {
proxy_pass http://localhost:8080/;
}
# http://localhost/wddd05/xxx -> http://localhost:8080/hahaxxx,请注意这里的haha和xxx之间没有斜杠,分析一下原因。
location /wddd05/ {
proxy_pass http://localhost:8080/haha;
}
# http://localhost/api6/xxx -> http://localhost:8080/haha/xxx
location /wddd06/ {
proxy_pass http://localhost:8080/haha/;
}
# http://localhost/wddd07/xxx -> http://localhost:8080/haha/xxx
location /wddd07 {
proxy_pass http://localhost:8080/haha;
}
# http://localhost/wddd08/xxx -> http://localhost:8080/haha//xxx,请注意这里的双斜杠。
location /wddd08 {
proxy_pass http://localhost:8080/haha/;
}
}
- END -
搭建一套完整的企业级 K8s 集群(kubeadm方式)
点亮,服务器三年不宕机