- 配置基础知识
先现切换至超级用户
[root@localhost ~]# ping www.baidu.com //先测试网络是否通畅
PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data.
64 bytes from 14.215.177.38: icmp_seq=1 ttl=128 time=41.1 ms
64 bytes from 14.215.177.38: icmp_seq=2 ttl=128 time=39.0 ms
[root@localhost ~]# yum -y install httpd
已加载插件:fastestmirror, refresh-packagekit, security
......
更新完毕:
httpd.i686 0:2.2.15-69.el6.centos
完毕!
[root@localhost ~]# service httpd start //开启服务
正在启动 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
[确定]
[root@localhost ~]# chkconfig httpd on //设置开机自启服务
[root@localhost ~]# cd /etc/httpd/conf/
[root@localhost conf]# ls
httpd.conf magic
[root@localhost conf]# vi httpd.conf
- ServiceRoot”/etc/httpd” 工作目录不需要更改
- ServiceAdmin root@localhost 管理员的邮箱,可以不修改
- #ServiceName www.example.com:80 修改为:192.168.77.130
- DocumentRoot”/var/www/html” 文档的主目录 不用修改
- AddDefaultCharset UTF-8(默认字符集) 不用修改
[root@localhost conf]# vi httpd.conf //检查修改成功没
[root@localhost conf]# service httpd restart
停止 httpd: [确定]
正在启动 httpd: [确定]
[root@localhost conf]# cd /var/www/html
[root@localhost html]# vi index.html
[root@localhost html]# service httpd restart
停止 httpd: [确定]
正在启动 httpd: [确定]
测试:
创建html文件并编辑添加:
然后在点击文件
基本完成!!!!
- 配置关键技术
- 首先需要连通网络
- 关闭防火墙
- 注意自己虚拟ip不能写错
- 配置问题详解
基本没有问题 比较简单