当前位置首页 > Apache知识

Linux之Apache服务

阅读次数:267 次  来源:admin  发布时间:

centos6 部署Apache服务的步骤

1、准备环境

查看防火墙有没有关:service iptables statu

关闭防火墙:service iptables stop (chkconfig iptables off)

修改启动项:chkconfig iptables off

关闭selinux:setenforce 0 (SELINUX=disabled)

修改配置文件:vim /etc/sysconfig/selinux 修改 “SELINUX=disabled”

配置IP地址

2、安装软件包

yum install httpd -y

3、修改配置文件

vim /etc/httpd/conf/httpd.conf #配置文件

ServerRoot "/etc/httpd" #服务根目录  

Listen 80 #服务侦听端口

DocumentRoot "/var/www/html" #网站文件所在目录

创建html文件测试

Linux之Apache服务

4、重启服务

ervice httpd restart

5、测试

打开浏览器在地址栏中输入网站服务器地址:端口/路径

centos7 部署Apache服务的步骤

1、准备环境

查看防火墙有没有关:service firewalld statu

关闭防火墙:service firewalld stop (chkconfig iptables off)

开启防火墙中的端口: firewall-cmd --permanent --add-port=80/tc

加载防火墙配置:firewall-cma --reload

修改启动项:chkconfig firewalld off

关闭selinux:setenforce 0 (SELINUX=disabled)

修改配置文件:vim /etc/sysconfig/selinux 修改 “SELINUX=disabled”

配置IP地址

2、安装软件包

yum install httpd -y

3、修改配置文件

vim /etc/httpd/conf/httpd.conf #配置文件

ServerRoot "/etc/httpd" #用于指定守护进程httpd的运行目录  

Listen 80 #服务侦听端口

DocumentRoot "/var/www/html" #服务器对外发布的超文本文档存放的路径

创建html文件测试

Linux之Apache服务

4、重启服务

ervice httpd restart

5、测试

打开浏览器在地址栏中输入网站服务器地址:端口/路径

上一篇:CentOS6.6下安装配置Tomcat环境
下一篇:IIS和tomcat共用80端口