Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What does a slash mean in nginx

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report