搭建Lamp之安装apache

  • 笔者环境:CentOS6.9

1、切换root用户

#su
image.png

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

#yum install httpd
image.png

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

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

4、配置开机启动

#chkconfig –levels 235 httpd on
image.png

5、重启apache

#/etc/init.d/httpd start
image.png

6、测试

切记一定要关闭防火墙,防火墙,防火墙!!!

1) 即时生效,重启后复原
开启: service iptables start
关闭: service iptables stop
2) 永久性生效,需要重启后才能生效
开启: chkconfig iptables on
关闭: chkconfig iptables off
#service iptables stop
image.png
在浏览器中输入:ip地址+端口号(默认为80)
image.png
出现上面这个界面则安装成功。
备注:在CentOS 中 Apache 的默认根目录是 /var/www/html,配置文件 /etc/httpd/conf/httpd.conf。其他配置存储在 /etc/httpd/conf.d/ 目录

posted @ 2017-12-08 16:48  吴永生  阅读(298)  评论(0编辑  收藏  举报