惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
H
Heimdal Security Blog
K
Kaspersky official blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
S
Schneier on Security
G
GRAHAM CLULEY
U
Unit 42
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
C
CERT Recently Published Vulnerability Notes
Google DeepMind News
Google DeepMind News
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
C
Cisco Blogs
Cyberwarzone
Cyberwarzone
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
Security Archives - TechRepublic
Security Archives - TechRepublic
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 司徒正美
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
V
Visual Studio Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
Jina AI
Jina AI
P
Proofpoint News Feed
P
Proofpoint News Feed
有赞技术团队
有赞技术团队
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog
IT之家
IT之家
S
Security Affairs
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
N
News | PayPal Newsroom
Cloudbric
Cloudbric
AWS News Blog
AWS News Blog
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
NISL@THU
NISL@THU

冰雪殇璃陌梦の小站

冰雪殇璃陌梦の小站 冰雪殇璃陌梦の小站 冰雪殇璃陌梦の小站 冰雪殇璃陌梦の小站 冰雪殇璃陌梦の小站 冰雪殇璃陌梦の小站 冰雪殇璃陌梦の小站 冰雪殇璃陌梦の小站 冰雪殇璃陌梦の小站 冰雪殇璃陌梦の小站
冰雪殇璃陌梦の小站
冰雪殇璃陌梦 · 2022-05-14 · via 冰雪殇璃陌梦の小站

记录(shui)一下自己在建站过程中踩的一个坑,也给大家一个参考:

有一天在自己的博客随便乱点的时候,突然冒出来一个500 Internal Server Error.
HTTP-500错误
我寻思这可是静态博客,怎么可能出现 500 错误呢?
想起前几天改过 Nginx 的配置,于是赶紧去查对应的文件.

将网站的配置回滚之后,再次访问网址出现 404 错误:
网址返回404
所以去翻了一下 web 目录,发现由于刚建站没多久,对应的文件确实没来得及写(lll ¬ ω ¬)

此时问题就变成了哪个修改导致 404 错误变成了 500 错误?
继续排查上次对配置文件的修改,注意到了这个更改:当时为了把博客文章的.html后缀省略(强迫症看着实在难受>﹏<),使用了 Nginx 的try_files命令:

location / {
    try_files $uri $uri.html $uri/index.html;
}

谷歌搜索后发现try_files在找不到对应文件时会返回 500 错误;
所以一般要在最后面加上=404,强制把返回的错误码改为 404:

...
try_files xxx xxx =404;
...

一些小提示
Nginx 隐藏.html.php后缀的配置:

try_files $uri $url.php $uri/index.php $uri/index.html $uri.html $uri.htm =404;