码迷,mamicode.com
首页 > Web开发 > 详细

CentOS6.8 x86_64bit安装apache

时间:2018-01-31 15:38:45      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:2.2.3   ...   开始   gre   vhost   module   64bit   .com   common   

apache-2.2.34安装

1.安装基础依赖包
yum install zlib zlib-devel -y

2.创建安装目录并进入该目录上传已下载好的软件
cd /home/rcih/tools
rz -y ‘ httpd-2.2.34.tar.gz ‘

3.解压软件并进入解压好的目录下
tar xf httpd-2.2.34.tar.gz
cd httpd-2.2.34

4.开始编译安装
./configure --prefix=/application/apache2.2.34 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewrite

make&&make install

5.安装完毕后进入到apache的站点目录下创建虚拟主机的目录
cd /application/apache/htdocs/
mkdir bbs www blog

6.修改apache的配置文件,打开包含虚拟主机的配置文件的配置信息注释
cd /application/apache/conf
vim httpd.conf
......
Include conf/extra/httpd-vhosts.conf
......

7.进入apache目录下的配置目录下extra下面修改虚拟主机的配置文件
cd /application/apache/conf/extra
cp httpd-vhosts.conf httpd-vhosts.conf.bak
vim /application/apache/conf/extra/httpd-vhosts.conf
##############################################################
<VirtualHost *:80>
ServerAdmin 123456789@qq.com
DocumentRoot "/application/apache2.2.34/htdocs/www"
ServerName www.rich.com
ServerAlias rich.com
ErrorLog "logs/www-error_log"
CustomLog "logs/www-access_log" common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin 123456789@qq.com
DocumentRoot "/application/apache2.2.34/htdocs/bbs"
ServerName bbs.rich.com
ServerAlias rich.com
ErrorLog "logs/bbs-error_log"
CustomLog "logs/bbs-access_log" common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin 123456789@qq.com
DocumentRoot "/application/apache2.2.34/htdocs/blog"
ServerName blog.rich.com
ServerAlias rich.com
ErrorLog "logs/blog-error_log"
CustomLog "logs/blog-access_log" common
</VirtualHost>

8.修改apache安装目录下的启动配置文件
vim /application/apache/conf/httpd.conf
......
ServerName 127.0.0.1:80
.......
Options -Indexes FollowSymLinks
......

9.修改本地主机的hosts文件,添加IP与主机名的解析,根据自身主机名来修改
vim /etc/hosts
......
172.16.1.248 lamp
......

10.进入到刚创建的apache的站点目录下虚拟主机的目录并创建索引文件
cd /application/apache/htdocs

echo ‘apache www‘ >www/index.html
echo ‘apache bbs‘ >bbs/index.html
echo ‘apache blog‘ >blog/index.html

11.测试语法并启动apache服务
/application/apache/bin/apachectl -t
/application/apache/bin/apachectl start

12.测试服务是否成功启动
netstat -lntup|grep httpd

13.本地主机测试
curl www.rich.com

CentOS6.8 x86_64bit安装apache

标签:2.2.3   ...   开始   gre   vhost   module   64bit   .com   common   

原文地址:http://blog.51cto.com/11047966/2067321

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!