Apache v2.0.54 官方主頁: http://www.apache.org
http://www.apache.org/dist/httpd/httpd-2.0.54.tar.gz [7.16MB]
PHP v4.3.11 官方主頁: http://www.php.net
http://cn.php.net/distributions/php-4.3.11.tar.gz [4.64MB]
Zend Optimizer v2.5.10 官方主頁: http://www.zend.com
http://downloads.zend.com/optimizer/2.5.10/ZendOptimizer-2.5.10-linux-glibc21-i386.tar.gz [3.36MB]
MySQL v4.0.24 官方主頁: http://www.mysql.com
http://ftp.stu.edu.tw/pub/Unix/Database/Mysql/Downloads/MySQL-4.0/mysql-4.0.24.tar.gz [16.1MB]
GD Library v2.0.33 官方主頁: http://www.boutell.com/gd/
http://www.boutell.com/gd/http/gd-2.0.33.tar.gz [573KB]
FreeType v2.1.10 官方主頁: http://www.freetype.org
http://savannah.nongnu.org/download/freetype/freetype-2.1.10.tar.gz [1.31MB]
Jpeg v6b 官方主頁: http://www.ijg.org
ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz [598KB]
LibPNG v1.2.8 官方主頁: http://www.libpng.org/pub/png/
http://switch.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.8.tar.gz [498KB]
OpenSSL v0.9.7g 官方主頁: http://www.openssl.org
http://www.openssl.org/source/openssl-0.9.7g.tar.gz [2.98MB]
vsftpd v2.0.3 官方主頁: http://vsftpd.beasts.org
ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.0.3.tar.gz [149KB]
zlib v1.2.2 官方主頁: http://www.gzip.org/zlib/
http://www.zlib.net/zlib-1.2.2.tar.gz [420KB]
ClibPDF v2.02-r1-1 官方網(wǎng)站: http://www.fastio.com
http://www.fastio.com/clibpdf202r1.tar.gz [836KB]
mod_limitipconn v0.22 官方網(wǎng)站: http://dominia.org/djao/
http://dominia.org/djao/limit/mod_limitipconn-0.22.tar.gz [6.18KB]
Bandwidth Module v0.6 官方網(wǎng)站: http://www.ivn.cl/apache/
http://www.ivn.cl/apache/bw_mod-0.6.tgz [28.5KB]
Apache DoS Evasive Maneuvers Module v1.10 官方網(wǎng)站: http://www.nuclearelephant.com/projects/dosevasive/
http://www.nuclearelephant.com/projects/dosevasive/mod_dosevasive_1.10.tar.gz [19.1KB]
################
##### 安裝 #####
################
1、解壓縮,把所有源碼壓縮包放在一個目錄中,解壓縮所有 .tar.gz 壓縮包
for i in `ls *.gz`;do tar zxvf $i; done;
2、開始安裝
##### zlib #####
cd zlib-1.2.2
./configure
make
make install
cd ..
##### OpenSSL #####
cd openssl-0.9.7g
./config --prefix=/usr/local/ssl \
--openssldir=/usr/local/ssl \
shared \
zlib
make
make install
ln -s /usr/local/ssl /usr/lib/ssl
cd ..
##### MySQL #####
cd mysql-4.0.24
編輯 sql/mysqld.cc :
搜索:&max_connections, 0, GET_ULONG, REQUIRED_ARG, 100, 1, 16384, 0, 1,
修改:&max_connections, 0, GET_ULONG, REQUIRED_ARG, 1000, 1, 16384, 0, 1,
groupadd mysql
useradd -g mysql mysql
./configure \
--prefix=/server/mysql \
--sysconfdir=/server/mysql \
--without-isam \
--without-debug \
--enable-assembler \
--with-unix-socket-path=/tmp/mysql.sock \
--with-mysqld-user=mysql \
--with-extra-charset=all \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--localstatedir=/data/mysql/data
如果出現(xiàn)了以下錯誤:
checking for tgetent in -ltermcap... no
checking for termcap functions library... configure: error: No curses/termcap library found
說明 curses/termcap 庫沒有安裝
apt-cache search curses | grep lib
安裝 libncurses5-dev ,然后重新運行配置
mkdir /data
mkdir /data/mysql
mkdir /data/mysql/data
make
make install
/server/mysql/bin/mysql_install_db --user=mysql
chown -R mysql /data/mysql
chgrp -R mysql /data/mysql
chown -R root /server/mysql
chgrp -R mysql /server/mysql
cp /server/mysql/share/mysql/my-medium.cnf /server/mysql/my.cnf
/server/mysql/share/mysql/mysql.server start
/server/mysql/bin/mysqladmin -u root password 123456789
cd ..
##### Apache2 #####
cd httpd-2.0.54
./configure --prefix=/server/httpd \
--enable-so \
--with-mysql=/server/mysqld \
--enable-cgi \
--with-config-file-path=/server/httpd/conf \
--enable-track-vars \
--enable-mods-shared=all \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--enable-rewrite \
--with-mpm=worker \
--with-ssl=/usr/local/ssl \
--enable-ssl
make
make install
cd ..
##### mod_deflate #####
cd httpd-2.0.54/modules/filters
/server/httpd/bin/apxs -i -c -a mod_deflate.c
修改 Apache 配置文件 /server/httpd/conf/httpd.conf :
添加:
<Location />;
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|ico)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
#Header append Vary User-Agent env=!dont-vary
</Location>;
DeflateFilterNote ratio
LogFormat '"%v %h %l %u %t "%r" %>;s %b "%{Referer}i" "%{User-Agent}i"" (%{ratio}n)' deflate
CustomLog logs/deflate_log deflate
然后
cd ../../../
##### FreeType #####
cd freetype-2.1.10
./configure --prefix=/usr/local/freetype
make
make install
cd ..
##### LibPNG #####
cd libpng-1.2.8
cp scripts/makefile.linux makefile
make test
make install
cd ..
##### Jpeg #####
cd jpeg-6b
mkdir /usr/local/jpeg
mkdir /usr/local/jpeg/bin
mkdir /usr/local/jpeg/lib
mkdir /usr/local/jpeg/include
mkdir /usr/local/jpeg/man
mkdir /usr/local/jpeg/man/man1
./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
make
make install
cd ..
##### GD Library #####
cd gd-2.0.33
./configure --prefix=/usr/local/gd \
--with-jpeg=/usr/local/jpeg \
--with-freetype=/usr/local/freetype \
--with-png \
--with-zlib
make
make install
cd ..
##### ClibPDF #####
cd ClibPDF/source
cp Makefile.Linux makefile
make
make install
cd ..
##### PHP #####
cd php-4.3.11
./configure --prefix=/server/php \
--with-apxs2=/server/httpd/bin/apxs \
--with-gd=/usr/local/gd \
--enable-gd \
--enable-gd-native-ttf \
--with-jpeg-dir=/usr/local/jpeg \
--with-png \
--with-ttf \
--with-zlib \
--with-freetype-dir=/usr/local/freetype \
--enable-magic-quotes \
--with-mysql=/server/mysql \
--with-mysql-sock=/tmp/mysql.sock \
--with-iconv \
--with-mbstring \
--enable-mbstring \
--enable-track-vars \
--enable-force-cgi-redirect \
--enable-ftp \
--with-config-file-path=/server/httpd/conf \
--with-openssl=/usr/local/ssl \
--with-openssl-dir=/usr/local/ssl \
--with-cpdflib=/usr/local \
--with-pear=/server/php/pear
make
make install
cp php.ini-dist /server/httpd/conf/php.ini
cd ..
##### Zend Optimizer #####
cd ZendOptimizer-2.5.10-linux-glibc21-i386
./install
操作 [OK] [EXIT] [YES] [/server/zend] [/server/httpd/conf] [YES] [/server/httpd/bin/apachectl] [OK] [OK] [NO]
cd ..
##### mod_limitipconn #####
cd mod_limitipconn-0.22
/server/httpd/bin/apxs -i -c -a mod_limitipconn.c
修改 Apache 配置文件 /server/httpd/conf/httpd.conf:
查找:#ExtendedStatus On ,去掉注釋"#"
查找:CustomLog logs/access_log common ,修改成 CustomLog logs/access_log common env=!LIMITIP
添加:
<IfModule mod_limitipconn.c>;
<Location />;
MaxConnPerIP 5
NoIPLimit image/*
</Location>;
<Location /mp3>;
MaxConnPerIP 2
OnlyIPLimit audio/mpeg video
</Location>;
</IfModule>;
然后
cd ..
##### Bandwidth Module #####
cd bw_mod-0.6
/server/httpd/bin/apxs -i -c -a bw_mod-0.6.c
cd ..
帶寬限制在虛擬主機中設(shè)置
##### Apache DoS Evasive Maneuvers Module #####
cd mod_dosevasive
/server/httpd/bin/apxs -i -c -a mod_dosevasive20.c
cd ..
等一下啟動 Apache2 后可以測試
perl test.pl
###############################################################################################
現(xiàn)在,WEB 服務(wù)已經(jīng)安裝完畢!
測試 WEB 服務(wù):
mkdir /data/vhosts
mkdir /data/vhosts/localhost
啟動 Apache2
/server/httpd/bin/apachectl start
如果出錯請參考下一貼中的 httpd.conf 和 虛擬主機配置文件示例
MySQL 服務(wù)前面已經(jīng)啟動了,密碼是:123456789
編輯一個 info.php 放在 /data/vhosts/localhost 下面,內(nèi)容如下:
<?php
phpinfo();
?>;
測試: http://localhost/info.php
OK,看到 PHP 信息了吧
##### 開機自動啟動服務(wù) #####
cp /server/httpd/bin/apachectl /etc/init.d/httpd
cp /server/mysql/share/mysql/mysql.server /etc/init.d/mysql
recconf
配置,已經(jīng)有 httpd 和 mysql 選項了,選中,OK
如果沒有 rcconf ,用 apt-get install rcconf 安裝
#######################
##### 使 SSL 工作 #####
#######################
mkdir /server/ssl
cd /server/ssl
##### 手工簽署證書 #####
/usr/local/ssl/bin/openssl genrsa -des3 \
-rand 任意大文件1:任意大文件2 \
-out server.key 1024
輸入密碼
重復(fù)密碼
/usr/local/ssl/bin/openssl req -new -key server.key -out server.csr
Enter pass phrase for localhost.key: #<--## 輸入密碼
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CN #<--## 國家代碼
State or Province Name (full name) [Some-State]:LN #<--## 省或州
Locality Name (eg, city) []:SY #<--## 城市
Organization Name (eg, company) [Internet Widgits Pty Ltd]:micronsky.net #<--## 組織名稱
Organizational Unit Name (eg, section) []:root #<--## 部門
Common Name (eg, YOUR name) []:keelort #<--## 名字
Email Address []:keelort@gmail.com #<--## 電子郵件
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: #<--## 直接回車就可以
An optional company name []: #<--## 直接回車就可以
/usr/local/ssl/bin/openssl x509 -req \
-days 3650 \
-in server.csr \
-signkey server.key \
-out server.crt
................................................................................
注意:SSL 部分目前還不是很明白,apachectl startssl 啟動后 http:// 不能用,只能用 https:// 連接,
不知道怎么回事請高手指教,暫時沒有寫全
###############################################################################################
##### vsftpd #####
cd vsftpd-2.0.3
編輯 builddefs.h :
#define VSF_BUILD_PAM
修改為
#undef VSF_BUILD_PAM
編輯 defs.h :
#define VSFTP_DEFAULT_CONFIG "/etc/vsftpd.conf"
修改為
#define VSFTP_DEFAULT_CONFIG "/server/vsftpd/conf/vsftpd.conf"
make
useradd nobody
mkdir /usr/share/empty
mkdir /data/ftp
useradd -d /data/ftp ftp
chown root:root /data/ftp
chmod og-w /data/ftp
install -m 755 vsftpd /server/vsftpd/vsftpd
install -m 644 vsftpd.8 /usr/share/man/man8
install -m 644 vsftpd.conf.5 /usr/share/man/man5
mkdir /server/vsftpd/conf
install -m 644 vsftpd.conf /server/vsftpd/conf/vsftpd.conf
使 vsftpd 以 standalone 方式啟動:
編寫名為 vsftpd 的啟動腳本:
#!/bin/sh
# /etc/init.d/vsftpd
#
set -e
# Exit if vsftpd.conf doesn't have listen=yes or listen_ipv6=yes
# (mandatory for standalone operation)
if [ -f /server/vsftpd/conf/vsftpd.conf ] && ! egrep -iq "^ *listen(_ipv6)? *= *yes"
/server/vsftpd/conf/vsftpd.conf; then
exit 0
fi
DAEMON=/server/vsftpd/vsftpd
NAME=vsftpd
test -x $DAEMON || exit 0
case "$1" in
start)
echo -n "Starting FTP server: $NAME"
start-stop-daemon --start --background -m --pidfile /tmp/vsftpd.pid --exec $DAEMON
echo "."
;;
stop)
echo -n "Stopping FTP server: $NAME"
start-stop-daemon --stop --pidfile /tmp/vsftpd.pid --oknodo --exec $DAEMON
echo "."
;;
restart)
echo -n "Restarting FTP server: $NAME"
start-stop-daemon --stop --pidfile /tmp/vsftpd.pid --oknodo --exec $DAEMON
start-stop-daemon --start --background -m --pidfile /tmp/vsftpd.pid --exec $DAEMON
echo "."
;;
reload|force-reload)
echo "Reloading $NAME configuration files"
start-stop-daemon --stop --pidfile /tmp/vsftpd.pid --signal 1 --exec $DAEMON
echo "."
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload}"
exit 1
;;
esac
exit 0
運行 rcconf 選中 vsftpd ,確定
重新啟動,試試試不是所有的服務(wù)都啟動了,呵呵...
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請
點擊舉報。