搭建Lamp之安装apache
2017-12-08 本文已影响0人
我想我是
- 笔者环境:CentOS6.9
1、切换root用户
#su

2、Centos里面已经封装了apache的软件,直接可以进行安装
#yum install httpd

3、接下来会出现Is this ok ?当然是y,回车,继续等待。

接下来会出现完成安装的标志:

4、配置开机启动
#chkconfig –levels 235 httpd on

5、重启apache
#/etc/init.d/httpd start

6、测试
切记一定要关闭防火墙,防火墙,防火墙!!!
1) 即时生效,重启后复原
开启: service iptables start
关闭: service iptables stop
2) 永久性生效,需要重启后才能生效
开启: chkconfig iptables on
关闭: chkconfig iptables off
#service iptables stop

在浏览器中输入:ip地址+端口号(默认为80)

出现上面这个界面则安装成功。
备注:在CentOS 中 Apache 的默认根目录是 /var/www/html,配置文件 /etc/httpd/conf/httpd.conf。其他配置存储在 /etc/httpd/conf.d/ 目录