CentOS6上Apache服务器的安装与配置

参考网址:
http://www.linuxidc.com/Linux/2014-01/95256.htm
http://blog.csdn.net/chaishen10000/article/details/46897901

一、安装Apache程序,一般有三种安装方式:

1.直接yum安装;

yum -y install httpd

2.下载rpm包,上传至服务器进行安装;

rpm -qa | grep httpd

3.通过原代码编译安装;


启动/停止/重新启动/状态

service httpd start
service httpd stop
service httpd restart
service httpd status

pstree | grep httpd //验证服务是否启动,比较少用;
启动时,如果提示如下信息:
正在启动 httpd:httpd: Could not reliably determine the server’s fully qualified domain name, using localhost.localdomain for ServerName
编辑/etc/httpd/conf/httpd.conf
找到如下内容:
ServerName www.example.com:80
更改为
ServerName localhost:80
再重启一下Apache服务即可;
测试安装配置是否成功 >> http://ip地址

如果打不开,那应该是iptables的问题;
编辑/etc/sysconfig/iptables
添加如下内容:
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 443 -j ACCEPT
然后重启一下iptables服务可;

猜你喜欢

转载自blog.csdn.net/chenxy02/article/details/79099593