大网数据广告活动
服务器运维问答

How to trouble shoot 404 error

· 52CE 我爱测

Few days ago I faced an interview and one of the questions was what would I do if I get a 404 error from a webserver. My answer was check the logs. The interviewer said that first I have to ping and check whether I have connectiv…

问题原文

原帖链接 · eranga · CC BY-SA 3.0

Few days ago I faced an interview and one of the questions was what would I do if I get a 404 error from a webserver. My answer was check the logs. The interviewer said that first I have to ping and check whether I have connectivity to the server .I don't regularly work with web servers at my current work place. My question is will we get a 404 error if we do not have connectivity to a web server?

已采纳解答

原帖链接 · bao7uo · CC BY-SA 3.0

Will we get a 404 error if we do not have connectivity to a web server?

No! :-)

The question said "a 404 error from a webserver". If it actually said that then the fact you got the error from the server implies that you have connectivity to it.

Regardless of the wording of the question, 404 means that the resource could not be found by the web server. It is an HTTP error code sent from the web server to the browser. So if you receive a 404 error from the web server, you already have proven connectivity to it. It often means you have the correct hostname/domain name, but the wrong directory name/page name.

E.g. www.this-bit-is-correct.com/this-bit-is-mistyped

When the interviewer mentioned ping, either they didn't know what they were talking about, or they were double bluffing!

Exceptions:

Some web servers return 404 for any error (e.g. 500 internal server error etc). However, this still means you have connectivity to the web server.

Another exception could be a load balancer or proxy returning 404 when they can't see the web server they are trying to refer you to.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-01-07)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。