What does a slash mean in nginx
This article mainly introduces what the slash in nginx means, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
I wonder if you will be full of doubts about whether to add slashes when configuring nginx every day.
When configuring location and proxy_pass, the difference between adding "/" and not adding "/" is verified by practice today.
Access address through nginx proxy: http://127.0.0.1/v1/pt/apply/page
Location and proxy_pass do not add slashes.
Location / v1 {proxy_pass http://127.0.0.1:8899;}
Actual access proxy address: http://127.0.0.1:8899/v1/pt/apply/page
Location with slash, proxy_pass without slash
Location / v1 / {proxy_pass http://127.0.0.1:8899;}
Actual access proxy address: http://127.0.0.1:8899/v1/pt/apply/page
Location with no slash, proxy_pass with slash
Location / v1 {proxy_pass http://127.0.0.1:8899/;}
Actual access proxy address: http://127.0.0.1:8899//pt/apply/page
Location and proxy_pass are all slashed.
Location / v1 / {proxy_pass http://127.0.0.1:8899/;}
Actual access proxy address: http://127.0.0.1:8899/pt/apply/page
Location without slash, proxy_pass with "v1"
Location / v1 {proxy_pass http://127.0.0.1:8899/v1;}
Actual access proxy address: http://127.0.0.1:8899/v1/pt/apply/page
Location plus slash, proxy_pass plus "v1"
Location / v1 / {proxy_pass http://127.0.0.1:8899/v1;}
Actual access proxy address: http://127.0.0.1:8899/v1pt/apply/page
Location without slash, proxy_pass with "v1 /"
Location / v1 {proxy_pass http://127.0.0.1:8899/v1/;}
Actual access proxy address: http://127.0.0.1:8899/v1/pt/apply/page
Location plus slash, proxy_pass plus "v1 /"
Location / v1 / {proxy_pass http://127.0.0.1:8899/v1/;}
Actual access proxy address: http://127.0.0.1:8899/v1/pt/apply/page
Proxy_pass proxy address port without any characters, forwarding address: proxy address + access URL directory part
There is a directory (including /) after the proxy_pass proxy address port, and the forwarding address: proxy address + access URL directory part removes the location matching directory ("v1" or "v1 /" in the example)
Thank you for reading this article carefully. I hope the article "what is the slash in nginx" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!