ddxiami

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2334|回复: 0

[web服务] apache-2.4.4编译安装

[复制链接]
发表于 2013-5-22 15:44:23 | 显示全部楼层 |阅读模式
#安装环境
yum -y install zlib-devel pcre-devel openssl openssl-devel gcc make vixie-cron  gcc-c++
useradd -d /dev/null -s /sbin/nologin webuser
echo "已完成环境更新"

#安装pcre-8.32.tar.gz
#解压程序包
tar xzvf pcre-8.32.tar.gz
cd pcre-8.32
./configure --prefix=/usr/local/pcre
make && make install

#安装apache
tar zxvf httpd-2.4.4.tar.gz

#将apr、apr-util移动到apache的srclib目录
tar xzvf apr-1.4.6.tar.gz
tar xzvf apr-util-1.5.1.tar.gz
mv apr-1.4.6 httpd-2.4.4/srclib/apr
mv apr-util-1.5.1 httpd-2.4.4/srclib/apr-util

#编译安装httpd
cd httpd-2.4.4
./configure --prefix=/usr/local/apache --enable-so --enable-deflate=shared \
--enable-ssl=shared --enable-expires=shared --enable-headers=shared --enable-rewrite=shared \
--enable-static-support --with-included-apr --with-mpm=prefork --enable-cache --enable-file-cache \
--with-pcre=/usr/local/pcre
make && make install

#配置开机启动,并修改httpd
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
sed '2i\# chkconfig: 345 90 90' /etc/init.d/httpd > tmp;mv -f tmp /etc/init.d/httpd
sed '3i\# description: Apache' /etc/init.d/httpd > tmp;mv -f tmp /etc/init.d/httpd
sed '188i\ServerName localhost:80' /usr/local/apache/conf/httpd.conf > tmp;mv -f tmp /usr/local/apache/conf/httpd.conf

#chkconfig成启动程序
chmod +x /etc/init.d/httpd
chkconfig httpd on

#启动程序
service httpd restart

#需要修改用户和组为webuser
#不显示目录结构,找到“Options Indexes FollowSymLinks”,修改为Options FollowSymLinks
#开启Apache支持伪静态,找到“AllowOverride None”,修改为AllowOverride All

#查看apache版本
#service httpd -v

#查看apache已编译安装的模块
#service httpd -M

#添加php支持,在末尾处加下如下代码
#    AddType application/x-httpd-php .php .phtml
#    AddType application/x-httpd-php-source .phps
#    PHPIniDir "conf"

#站点配置范本,vhost.comf
==========================================================================
<VirtualHost *:80>
        ServerAdmin webmaster@3366idc.com

        DocumentRoot /data/www/epbacn/public

        ServerName new.ddxiami.com
        ServerAlias new.ddxiami.com

        #每天单独生成一个日志文件
        ErrorLog "|/usr/local/apache/bin/rotatelogs /data/logs/epbacn/error%Y%m%d.log 86400 480"

        #每天单独生成一个日志文件
        CustomLog "|/usr/local/apache/bin/rotatelogs /data/logs/epbacn/access%Y%m%d.log 86400 480" common


        <Directory "/data/www/epbacn/public">
                        Options FollowSymLinks
                        AllowOverride All
                        Order allow,deny
                        allow from all
        </Directory>

</VirtualHost>
==========================================================================
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|技术文档库 ( 闽ICP备15017263号-2 )|网站地图

GMT+8, 2025-5-19 00:24 , Processed in 0.034923 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表