Chinaunix首页 | 论坛 | 博客
  • 博客访问: 941546
  • 博文数量: 80
  • 博客积分: 2380
  • 博客等级: 大尉
  • 技术积分: 1049
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-14 11:06
个人简介

Only to find a successful way, not to find excuses for failure!

文章分类

全部博文(80)

文章存档

2016年(2)

2015年(4)

2014年(10)

2013年(10)

2012年(7)

2011年(17)

2010年(30)

分类: LINUX

2011-11-23 15:07:37

对HTTP服务进行全面测试
[1] 对HTML格式网页正确显示的测试

[root@sample ~]# vi /var/www/html/index.html  ← 建立测试页,内容如下:[code]


Hello,World!

Hello,World!

[/code]  然后在浏览器中输入“http://服务器IP地址”或者“http://你的域名”,如果出现“Hello,World!”,并且浏览器读取编码为简体中文,就OK。

  为了在这之后测试.htaccess,将默认为主页的index.html测试页删除。[code][root@sample ~]# rm -f /var/www/html/index.html[/code]  ← 删除刚刚测试用的网页  

[2] 对CGI的支持进行测试

[root@sample ~]# vi /var/www/html/test.cgi  ← 建立CGI测试页,内容如下:[code]#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "";
print "Hello,World!CGI is working!
";
print "";[/code][code][root@sample ~]# chmod 755 /var/www/html/test.cgi[/code]  ← 然后将CGI测试文件属性设置为755

  然后在浏览器中输入“http://服务器IP地址/test.cgi”或者“http://你的域名/test.cgi”,如果正确显示“Hello,World!CGI is working!”,说明对于CGI的支持没有问题。

[3] 对PHP的支持进行测试

[root@sample html]# vi /var/www/html/test.php  ← 建立PHP测试文件,内容如下:[code]phpinfo();
?> [/code]  然后在浏览器中输入“http://服务器IP地址/test.php”或者“http://你的域名/test.php”后,正确的显示出了服务器上PHP的详细信息,说明对PHP可以正确的支持。


[4] 对SSI进行测试

[root@sample ~]# vi /var/www/html/test.shtml  ← 建立SSI测试页,内容如下:[code]


Hello,World!

TEST SSI

2024/04/23 22:05:41

[/code]  然后在浏览器中输入“http://服务器IP地址/test.shtml”或者“http://你的域名/test.shtml”,如果正确显示当时的日期和时间,说明对于SSI的支持没有问题。

[5] 对.htaccess的支持进行测试

[root@sample ~]# vi /var/www/html/index.shtml  ← 建立.htaccess测试用的页,内容如下:[code]


Hello,World!

The name of the file is (none)

[/code]  然后在浏览器中输入“http://服务器IP地址”或者“http://你的域名”,如果显示“Forbidden”,说明.htaccess正常。

  然后建立一个.htaccess文件,并定义相应规则,如下:

[root@sample html]# vi /var/www/html/.htaccess  ← 建立.htaccess文件,内容如下:[code]DirectoryIndex index.shtml [/code]  这时,再次在浏览器中输入“http://服务器IP地址”或者“http://你的域名”,如果正确显示“ The name of the file is index.shtml”,说明.htaccess中的规则生效状态,OK。
阅读(7334) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~