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

Nginx publishes static files out of 404

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Not long ago with a static directory, take it for granted that it is quite simple, is not to write a directory. After matching, I can't do it all the time. I've been giving 404.

Looking for some articles, it seems that my configuration is correct, which is really strange.

When I was having lunch today, I suddenly thought that it might be because the catalogue was written at an extra level. I tried it after dinner, and sure enough.

This was written in the original configuration file:

Location / {

Root / opt/www

}

Location / test {

Root / tmp/test

}

Hint 404.

Now change the / tmp/test section to / tmp. Because the root directory set in location is also relative to server_name 's domain name or ip, location / test means to find the test directory in the directory you wrote. The way I used to write it, root / tmp/test is equivalent to accessing / tmp/test/test. This configuration is due to my misunderstanding.

Perhaps some students who understand mistakes like me, this memo, so that we do not make this mistake to waste time and energy investigation.

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

Servers

Wechat

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

12
Report