安装apache

mkdir /home/httpd
cd /home/httpd
wget http://archive.apache.org/dist/apr/apr-1.4.6.tar.gz  
tar -xvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apr
make && make install


cd /home/httpd
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz  
tar -xvf apr-util-1.3.12.tar.gz 
cd apr-util-1.3.12
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install


yum -y install gcc gcc-c++ zlib zlib-devel


cd /home/httpd
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz
tar -xvf pcre-8.32.tar.gz
cd /home/httpd/pcre-8.32
./configure --prefix=/usr/local/pcre
make && make install


cd /home/httpd
wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.29.tar.gz
tar -xvf httpd-2.4.29.tar.gz
cd /home/httpd/httpd-2.4.29


./configure --prefix=/usr/local/apache2.4 --with-arp=/usr/local/arp --with-apr-util=/usr/local/apr-util \
--with-prce=/usr/local/prce --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi \
--enable-rewrite --with-zlib --enable-modules=most --enable-mpms-shared=all 
#--with-mpm=event


make && make install


#etc/httpd24/httpd.conf  **********************************************
cp /usr/local/apache2.4/bin/apachectl /etc/init.d/httpd
cp /etc/httpd24/httpd.conf /etc/httpd24/httpd.conf.bak
sed -i '/#ServerName www\.example\.com\:80/a\ServerName www\.example\.com\:80' /etc/httpd24/httpd.conf


#cat /etc/init.d/httpd|grep -v ^#|grep -v ^$
#netstat -lntp|grep 80
#lsof -i :80
#/usr/local/apache2/bin/httpd –k start
#egrep -v '^[ ]*#|^$' /etc/httpd24/httpd.conf | nl


echo "/usr/local/apache2.4/bin/apachectl start">>/etc/rc.local




#apache 与 php 整合***************************************
#apache + php /etc/httpd24/httpd.conf **********
cp /etc/httpd24/httpd.conf /etc/httpd24/httpd.conf.bak
sed -i '/AddType application\/x\-gzip \.gz \.tgz$/a\    AddType application\/x\-httpd\-php\-source \.php5' /etc/httpd24/httpd.conf
sed -i '/AddType application\/x\-gzip \.gz \.tgz$/a\    AddType application\/x\-httpd\-php \.php' /etc/httpd24/httpd.conf


sed -i 's/    DirectoryIndex index\.html$/\#   DirectoryIndex index\.html/g' /etc/httpd24/httpd.conf
sed -i '/^<IfModule dir\_module>$/a\    DirectoryIndex index\.html index\.php' /etc/httpd24/httpd.conf




#vim /etc/httpd24/extra/httpd-vhosts.conf  多台虚拟机****************
#sed -i '/#Include \/etc\/httpd24\/extra\/httpd-vhosts\.conf/a\Include /etc/httpd24/extra/httpd-vhosts.conf' /etc/httpd24/httpd.conf


#(
#cat << EOP
#<VirtualHost *:80>
#     ServerName localhost                           #主机名
#     DocumentRoot "/usr/local/apache2.4/htdocs"     #网站位置
#     ServerAdmin root@localhost                     #管理
#     ProxyVia On
#     ProxyRequests Off                              #关闭正向代理
#     ProxyPreserveHost On                           #保存...
#     <Proxy *> 
#          Require all granted                       #允许授权工具
#     </Porxy>
##     ProxyPass / http://172.0.0.1:8080/             #反向代理
##     ProxyPassReverse / http://172.0.0.1:8080/
#     <Location />
#          Require all granted                       #允许授权用户访问
#     </Localtion>
#</VirtualHost>
#EOP
#) >> /etc/httpd24/extra/httpd-vhosts.conf


#vim /etc/hosts 做测试,要将域名做解析**********************************
#127.0.0.1 域名 简单



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值