|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
yum install zlib-devel -ywget http://mirror.bit.edu.cn/apache/httpd/httpd-2.2.31.tar.gztar 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-rewritemakemake installln -s /application/apache2.2.31/ /application/apachels -l /application/ |
|
1
2
|
/application/apache/bin/apachectl startnetstat -lntup|grep httpd |
|
1
2
3
4
5
6
7
8
9
|
cd /application/apache/conf/vim httpd.conf 修改98行ServerName 127.0.0.1:80修改132 <Directory "/application/apache2.2.31/html">修改378 Include conf/extra/httpd-mpm.conf修改396 Include conf/extra/httpd-vhosts.conf |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
[root@web02 conf]# cd extra/[root@web02 extra]# vim httpd-vhosts.conf <VirtualHost *:80> ServerAdmin oldboy@oldboyedu.com 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 oldboy@oldboyedu.com 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 oldboy@oldboyedu.com 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> |
|
1
2
3
4
5
6
7
|
mkdir -p /application/apache2.2.31/html/{www,bbs,blog}echo www.etiantian.org >/application/apache2.2.31/html/www/index.htmlecho bbs.etiantian.org >/application/apache2.2.31/html/bbs/index.htmlecho blog.etiantian.org >/application/apache2.2.31/html/blog/index.htmlmkdir /app/logs -p/application/apache/bin/apachectl -t/application/apache/bin/apachectl graceful |
|
1
2
3
|
curl www.etiantian.org curl bbs.etiantian.orgcurl blog.etiantian.org |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repoyum install zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-devel libmcrypt-devel mhash mhash-devel mcrypt openssl-devel -yrpm -qa zlib-devel libxml2-devel libjpeg-turbo-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libmcrypt-devel mhash mhash-devel mcrypt openssl-develmkdir -p /home/oldboy/toolscd /home/oldboy/toolswget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gztar zxf libiconv-1.14.tar.gzcd libiconv-1.14./configure --prefix=/usr/local/libiconvmakemake installcd .. |
|
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
cd /home/oldboy/toolstar xf php-5.5.26.tar.gzcd php-5.5.26./configure --prefix=/application/php5.5.26 --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-ftpmakemake installln -s /application/php5.5.26/ /application/php |
|
1
2
3
4
5
6
7
|
[root@web02 php-5.5.26]# ll /application/apache/modules/总用量 30568-rw-r--r-- 1 root root 9194 11月 10 20:37 httpd.exp-rwxr-xr-x 1 root root 31285631 11月 10 23:51 libphp5.so[root@web02 php-5.5.26]# grep libphp5.so /application/apache/conf/httpd.confLoadModule php5_module modules/libphp5.so[root@web02 php-5.5.26]# cp php.ini-production /application/php/lib/php.ini |
|
1
2
3
4
5
6
7
8
|
311行下增加:AddType application/x-httpd-php .php .phtmlAddType application/x-httpd-php-source .phps168行下增加:DirectoryIndex index.php index.html67行下增加User wwwGroup www |
|
1
2
3
4
5
|
useradd -u 513 -s /sbin/nologin www id www/application/apache/bin/apachectl -t/application/apache/bin/apachectl graceful |
|
1
2
3
|
<?phpphpinfo();?> |
|
1
2
3
4
5
6
7
8
9
|
<?php $link_id=mysql_connect('db01.etiantian.org','wordpress','123456') or mysql_error(); if($link_id){ echo "mysql successful by oldboy training!"; } else{ echo mysql_error(); }?> |
