##/bin/sh
Path=/home/oldboy/tools
[ ! -d $Path ] && mkdir $Path -p
cd /home/oldboy/tools
yum install zlib-devel -y
wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.2.31.tar.gz &&\
tar xf httpd-2.2.31.tar.gz &&\
cd httpd-2.2.31
./configure \
--prefix=/application/apache2.2.31 \
--enable-deflate \
--enable-expires \
--enable-headers \
--enable-modules=most \
--enable-so \
--with-mpm=worker \
--enable-rewrite
make &&\
make install
ln -s /application/apache2.2.31/ /application/apache
################PHP###########
cd ~
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel libmcrypt-devel mhash mcrypt freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel openssl-devel -y
cd /home/oldboy/tools
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install
cd ../
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
wget http://php.net/get/php-5.3.27.tar.gz/from/this/mirror
tar zxf mirror
cd php-5.3.27/
./configure \
--prefix=/application/php5.3.27 \
--with-apxs2=/application/apache/bin/apxs \
--with-mysql=mysqlnd \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-safe-mode \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--with-curlwrappers \
--enable-mbregex \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--enable-short-tags \
--enable-zend-multibyte \
--enable-static \
--with-xsl \
--enable-ftp
make
make install
ln -s /application/php5.3.27 /application/php
cp php.ini-production /application/php/lib/php.ini
cd /application/apache/conf/
sed -i ‘99cServerName 127.0.0.1:80\‘ httpd.conf
sed -i ‘311cAddType application/x-httpd-php .php .phtml\‘ httpd.conf
sed -i ‘312cAddType application/x-httpd-php-source .phps\‘ httpd.conf
sed -i ‘168cDirectoryIndex index.php index.html\‘ httpd.conf
sed -i ‘67cUser www\‘ httpd.conf
sed -i ‘68cGroup www\‘ httpd.conf
useradd -u 513 -s /sbin/nologin www
sed -i ‘99cServerName 127.0.0.1:80\‘ httpd.conf
sed -i ‘133c<Directory "/application/apache2.2.31/html">\‘ httpd.conf
sed -i ‘379cInclude conf/extra/httpd-mpm.conf\‘ httpd.conf
sed -i ‘397cInclude conf/extra/httpd-vhosts.conf\‘ httpd.conf
cd /application/apache/conf/extra
sed -i ‘27,42 d‘ /application/apache/conf/extra/httpd-vhosts.conf
##/bin/sh
echo "<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/application/apache2.2.31/html/www"
ServerName www.etiantian.org
ServerAlias etiantian.org
ErrorLog "/app/logs/www-error_log"
CustomLog "/app/logs/www-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/application/apache2.2.31/html/bbs"
ServerName bbs.etiantian.org
ErrorLog "/app/logs/bbs-error_log"
CustomLog "/app/logs/bbs-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/application/apache2.2.31/html/blog"
ServerName blog.etiantian.org
ErrorLog "/app/logs/blog-error_log"
CustomLog "/app/logs/blog-access_log" common
</VirtualHost>" >>/application/apache/conf/extra/httpd-vhosts.conf
/application/apache/bin/apachectl graceful
#######感觉很菜有没有更高端一点的请教一下/(ㄒoㄒ)/~~########