linux-apache初体验

初次体验apache,在本机进行测试。

1 检查本机是否已安装httpd包

rpm -qa |grep httpd

[[email protected] html]# rpm -qa|grep httpd
httpd-tools-2.2.15-29.el6.centos.x86_64
httpd-2.2.15-29.el6.centos.x86_64

检查结果,已安装httpd包

2 修改/etc/httpd/conf/httpd.conf配置文件

DirectoryIndex index.html index.html.var  意思是首页名称是index.html,如果index.html找不到,就使用index.html.var作为首页

linux-apache初体验

3  在/var/www/html目录下创建index.html文件,写入测试内容“hello world”,并启动httpd服务

在启动过程中,出现了一个小问题

[[email protected] html]# /etc/init.d/httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 220.250.64.26 for ServerName

4  我怀疑是DNS问题,打开浏览器,输入http://127.0.0.1,正常打开;http://localhost,却打不开,确认是DNS问题。编辑/etc/resolve.conf文件,然后重启网络服务。

5  再次测试,成功

linux-apache初体验