CentOS 7安装配置Apache HTTP Server

原文 CentOS 7安装配置Apache HTTP Server

 

RPM安装httpd

# yum -yinstall httpd

//安装httpd会自动安装一下依赖包:

apr

apr-util

httpd-tools

mailcap

# rpm -qi httpd

Name      : httpd

Version    : 2.4.6

Release    : 18.el7.centos

Architecture: x86_64

Install Date: Mon 11 Aug 2014 02:44:55 PMCST

Group      : System Environment/Daemons

Size      : 9793373

License    : ASL 2.0

Signature  : RSA/SHA256, Wed 23 Jul 2014 11:21:22 PM CST, Key ID 24c6a8a7f4a80eb5

Source RPM : httpd-2.4.6-18.el7.centos.src.rpm

Build Date : Wed 23 Jul 2014 10:49:10 PM CST

Build Host : worker1.bsys.centos.org

Relocations : (not relocatable)

Packager  : CentOS BuildSystem <http://bugs.centos.org>

Vendor    : CentOS

URL        : http://httpd.apache.org/

Summary    : Apache HTTP Server

Description :

The Apache HTTP Server is a powerful,efficient, and extensible web server.

修改配置文件

# cd

/etc/httpd/conf

# ls

httpd.conf

magic

#cp httpd.conf httpd.conf.origin    //将原有配置文件备份

# more httpd.conf

//查看配置文件,我们注意到以一配置:

DocumentRoot"/var/www/html"

//特别是要注意这个配置

//这是Apache 2.4的一个新的默认值,拒绝所有的请求!

<Directory />

AllowOverride none

Require all denied

</Directory>

//设置为自动启动

# systemctl enable httpd.service

ln -s‘/usr/lib/systemd/system/httpd.service‘ ‘/etc/systemd/system/multi-user.target.wants/httpd.service‘

//在centos7中chkconfig httpd on 被替换成 systemctl enable httpd

配置WEB站点 (假设使用/wwwroot目录下的文档)

//创建两个网站的目录结构及测试用页面文件

# mkdir/wwwroot/www

# echo"www.linuxidc.local" > /wwwroot/www/index.html

# mkdir/wwwroot/crm

# echo"crm.linuxidc.local" > /wwwroot/crm/index.html

//配置虚拟机主机

# cd/etc/httpd/

# mkdirvhost-conf.d

# echo"Include vhost-conf.d/*.conf" >> conf/httpd.conf

# vi/etc/httpd/vhost-conf.d/vhost-name.conf

//添加如下内容

<VirtualHost *:80>

ServerNamewww.linuxidc.local

DocumentRoot /wwwroot/www/

</VirtualHost>

<Directory /wwwroot/www/>

Requireall granted

</Directory>

<VirtualHost *:80>

ServerNamecrm.linuxidc.local

DocumentRoot /wwwroot/crm/

</VirtualHost>

<Directory /wwwroot/crm/>

Require ip192.168.188.0/24  //可以设置访问限制

</Directory>

时间: 2024-10-04 02:32:58

CentOS 7安装配置Apache HTTP Server的相关文章

CentOS7安装配置Apache HTTP Server

安装httpd 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 # yum -yinstall httpd //安装httpd会自动安装一下依赖包: apr apr-util httpd-tools mailcap # rpm -qi httpd Name       : httpd Version    : 2.4.6 Release    : 18.el7.centos Architecture: x8

转帖:CentOS 6安装配置LAMP服务器(Apache+PHP5+MySQL)

这篇文章主要介绍了CentOS 6 安装配置LAMP服务器(Apache+PHP5+MySQL)的方法,需要的朋友可以参考下 准备篇: 1.配置防火墙,开启80端口.3306端口vi /etc/sysconfig/iptables-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #允许80端口通过防火墙-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -

Centos 6.4安装配置apache平台的svn服务器

一.安装apache.subversion服务 #yum install httpd subversion subversion-devel mod_dav_svn -y 二.配置apache服务器 # sed '{/^$/d;/#/d}' /etc/httpd/conf/httpd.conf ServerTokens OS ServerRoot "/etc/httpd" PidFile run/httpd.pid Timeout 60 KeepAlive Off MaxKeepAli

Linux下安装配置Apache服务器

Linux下安装配置Apache服务器 1. 安装Apache [[email protected] ~]# yum –y install httpd 2. 启动Apache [[email protected] ~]# systemctl start httpd 3. 查看进程 [[email protected] ~]# systemctl status httpd httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib

Centos7安装配置Apache+PHP+Mysql+phpmyadmin

转载自: Centos7安装配置Apache+PHP+Mysql+phpmyadmin 一.安装Apache yum install httpd 安装成功后,Apache操作命令: systemctl start httpd //启动apache systemctl stop httpd //停止apache systemctl restart httpd //重启apache systemctl enable httpd //设置apache开机启动 异常处理我再阿里云上配置并出现启动Apac

记录:CentOS 7 安装配置分布式文件系统 FastDFS 5.1.1

CentOS 7 安装配置分布式文件系统 FastDFS 5.1.1 软件下载:http://download.csdn.net/download/qingchunwuxian1993/9897458 yum-y install net-tools.x86_64 前言 项目中用到文件服务器,有朋友推荐用FastDFS,所以就了解学习了一番,感觉确实颇为强大,在此再次感谢淘宝资深架构师余庆大神开源了如此优秀的轻量级分布式文件系统,本篇文章就记录一下FastDFS的最新版本5.1.1在CentOS7

RedHat 7 安装配置Apache 2.4

前两天测试了在RedHat 6上安装配置Apache httpd 2.2.31(详见http://jiangjianlong.blog.51cto.com/3735273/1858453)后,再来测试一下在RedHat 7安装配置Apache httpd 2.4.23.本文的内容主要包括:安装部署Apache 2.4.23.配置基于域名的虚拟主机.配置基于端口的虚拟主机.配置虚拟目录.修改默认页面.配置系统服务并设置开机启动. 测试环境: 操作系统版本:Red Hat Enterprise Li

RedHat 6 安装配置Apache 2.2

本文主要测试Redhat 6安装配置Apache httpd 2.2.31,内容包括:安装部署Apache 2.2.31.配置基于域名的虚拟主机.配置基于端口的虚拟主机.配置虚拟目录.修改默认页面和设置开机启动. 测试环境: 操作系统版本:Red Hat Enterprise Linux Server release 6.5 (Santiago),最小化安装 gcc版本:gcc-4.4.7-4.el6.x86_64(操作系统介质自带) Apache版本:httpd-2.2.31.tar.gz a

Linux安装配置apache

Linux安装配置apache 1.获取软件: http://httpd.apache.org/  httpd-2.2.21.tar.gz 2.安装步骤: 解压源文件: 1 tar zvxf httpd-2.2.21.tar.gz 2 cd httpd-2.2.213 ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite 4 make5 make install 运行./configure 命令进行编译源代码,