简体   繁体   English

Linux - 故障排除网页

[英]Linux - Trouble Shooting Web Page

I was asked this question last night by a friend and I am stumped. 昨晚我被朋友问了这个问题,我很难过。 So I thought I would ask here. 所以我想我会问这里。

The question is: 问题是:

How would you trouble shoot a web page that is not loading on a linux web server? 你怎么会麻烦拍摄一个没有加载到linux web服务器上的网页?

Check your Network Interface Configuration card first: 首先检查网络接口配置卡:

Open a terminal, then type: ifconfig . 打开终端,然后输入: ifconfig

Verify the interface you are using has an ip assigned. 验证您使用的接口是否已分配IP。 eg: 例如:

An active interface looks like this: 活动界面如下所示:

wlan0    Link encap:Ethernet  HWaddr 00:06:25:09:6A:D7
         inet addr:216.10.119.243  Bcast:216.10.119.255 <--notice ip here 
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:2924 errors:0 dropped:0 overruns:0 frame:0
         TX packets:2295 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:100
         RX bytes:180948 (176.7 Kb)  TX bytes:166521 (162.6 Kb)
         Interrupt:10 Memory:c88b5000-c88b6000

And a shutdown interface: 和关机界面:

wlan0   Link encap:Ethernet  HWaddr 00:06:25:09:6A:D7
        BROADCAST MULTICAST  MTU:1500  Metric:1
        RX packets:2924 errors:0 dropped:0 overruns:0 frame:0
        TX packets:2287 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:100
        RX bytes:180948 (176.7 Kb)  TX bytes:166377 (162.4 Kb)
        Interrupt:10 Memory:c88b5000-c88b6000

If you believe the server is able to connect to internet, send and receive some packages from it to test if it is able to transfer data properly through the internet: 如果您认为服务器能够连接到互联网,请发送和接收来自它的一些软件包,以测试它是否能够通过互联网正确传输数据:

From another computer, in the terminal type the command ping followed by your server's ip (the one you got with the command ifconfig), eg: 从另一台计算机,在终端中键入命令ping,然后是服务器的ip(使用命令ifconfig获得的那个),例如:

ping -c 10 216.10.119.243

the -c 10 part is for only sending 10 packets (that way you dont have to stop it with ctrl C). -c 10部分仅用于发送10个数据包(这样你就不必用ctrl C来停止它)。

After that, you can use the curl utility. 之后,您可以使用curl实用程序。 It acts like a text based Web browser in which you can select to see either the header or complete body of a Web page's HTML code displayed on your screen. 它就像一个基于文本的Web浏览器,您可以在其中选择查看屏幕上显示的网页HTML代码的标题或完整正文。

A good start is to use the curl command with the -I flag to view just the Web page's header and HTTP status code. 一个好的开始是使用带有-I标志的curl命令来仅查看网页的标头和HTTP状态代码。 If you dont use -I then you will see all the we page's html code displayed on the screen. 如果您不使用-I,那么您将看到屏幕上显示的所有页面的html代码。

So, type curl -I and then the ip of your server, for example 因此,例如,键入curl -I然后输入服务器的ip

curl -I 216.10.119.243

You can use the wget command to download a Web site's Web pages, including the entire directory structure of the Web site, to a local directory of yours. 您可以使用wget命令将Web站点的Web页面(包括Web站点的整个目录结构)下载到您的本地目录中。

If you activate timestamping (-N), you view not only the HTML content of the Web site's index page in your local directory, but also the download speed, file size and the start and stop times for the download. 如果激活时间戳(-N),则不仅可以查看本地目录中网站索引页的HTML内容,还可以查看下载速度,文件大小以及下载的开始和停止时间。 You could use it like this: 你可以像这样使用它:

wget -N 216.10.119.243

If you want to see the amount of traffic in and out of your server, use: 如果要查看进出服务器的流量,请使用:

netstat -an

Lastly use 最后使用

traceroute -I 216.10.119.243

to verify the route path and transit times of packets between your machine and the server you are troubleshooting. 验证计算机与正在排除故障的服务器之间的数据包的路径路径和传输时间。

That should do it. 应该这样做。 Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM