时间: 2007-08-25 / 分类: WEB后端编程 - 开发与实践 / 浏览次数: / 0 个评论 发表评论
Apache PHP MySQL Zend GD OpenSSL vsftpd … 完全编译安装手册
12条经典摄影技巧
WEB前端开发中的一些编程风格和书...
CSS Hack浏览器兼容IE6+IE7+IE8+IE9+FF
黄金分割与摄影构图

################
##### 软件 #####
################

v2.0.54 官方主页: http://www..org
http://www.apache.org/dist/httpd/httpd-2.0.54.tar.gz [7.16MB]

v4.3.11 官方主页: http://www..net
http://cn.php.net/distributions/php-4.3.11.tar.gz [4.64MB]

Optimizer v2.5.10 官方主页: http://www..com
http://downloads.zend.com/optimizer/2.5.10/ZendOptimizer-2.5.10-linux-glibc21-i386.tar.gz [3.36MB]

v4.0.24 官方主页: http://www..com
http://ftp.stu.edu.tw/pub/Unix/Database/Mysql/Downloads/MySQL-4.0/mysql-4.0.24.tar.gz [16.1MB]
Library v2.0.33 官方主页: http://www.boutell.com//
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]

v0.9.7g 官方主页: http://www..org
http://www.openssl.org/source/openssl-0.9.7g.tar.gz [2.98MB]

v2.0.3 官方主页: http://.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 官方网站: http://www.fastio.com
http://www.fastio.com/clibpdf202r1.tar.gz [836KB]

mod_limitipconn v0.22 官方网站: http://dominia.org/djao/
http://dominia.org/djao/limit/mod_limitipconn-0.22.tar.gz [6.18KB]

Bandwidth Module v0.6 官方网站: http://www.ivn.cl/apache/
http://www.ivn.cl/apache/bw_mod-0.6.tgz [28.5KB]

Apache DoS Evasive Maneuvers Module v1.10 官方网站: 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 ..

1.安装mysql 4.1.11
# groupadd mysql
# useradd -g mysql mysql
# wget http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-4.1.11.tar.gz/from/http://mysql.new21.com/
# tar -zxvf mysql-4.1.11.tar.gz
# cd mysql-4.1.11
# ./configure –prefix=/usr/local/mysql –with-charset=gbk
# make
# make install
# cp support-files/my-medium.cnf /etc/my.cnf
设置自启动
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 700 /etc/rc.d/init.d/mysqld
# chkconfig –add mysqld
安装完以后要初始化数据库,要是升级安装的请跳过
# cd /usr/local/mysql
# /usr/local/mysql/bin/mysql_install_db –user=mysql
# chown -R root .
# chown -R mysql var
# chgrp -R mysql .
# /usr/local/mysql/bin/mysqld_safe –user=mysql &

好了,至此mysql安装完毕,你可以这样起动你的mysql服务
# /etc/rc.d/init.d/mysqld start
# ln -s /usr/local/mysql/bin/mysql /sbin/mysql
# ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin

为了能让系统找到mysql,请运行如下命令
# PATH=$PATH:/usr/local/mysql/bin
# export PATH
# echo “/usr/local/mysql/lib/mysql” >> /etc/ld.so.conf
# ldconfig
日志管理
开启错误日志 (在[safe_mysqld]项下添加)
# vi /etc/my.cnf
[safe_mysqld]
err-log=/var/log/mysqld/err.log

开启常规日志和更新日志 (在[mysqld]项下添加)
# vi /etc/my.cnf
[mysqld]
log=/var/log/mysqld/log.log
log-update=/var/log/mysqld/update.log

创建日志文件并设置权限
# mkdir /var/log/mysqld
# touch /var/log/mysqld/err.log /var/log/mysqld/log.log /var/log/mysqld/update.log
# chown -R mysql.mysql /var/log/mysqld

# service mysqld restart

说明:
错误日志包含了服务器写入标准错误输出设备的所有消息,同时还包括了mysql服务的启动和关闭事件
常规日志用来记录有关mysql服务器运行的常规信息,包括用户的连接、查询及其他各种时间
更新日志用来记录修改数据库的查询信息,包括所有涉及数据库修改的SQl语句的查询记录
建议调试结束后关闭日志

Configure
Configure the Apache build with mod_ssl and mod_deflate…
…httpd-2.0.59]# ./configure –prefix=/usr/local/httpd-2.0.59 –enable-mods-shared=all –enable-logio –enable-deflate –enable-ssl –with-z=/usr/local –with-ssl=/usr/local/ssl
 –prefix=/usr/local/httpd-2.0.59
[this is the installation location; default is /usr/local/apache2 — which we will symlink]
 –enable-mods-shared=all
[build all standard modules in the package (still excludes some modules); build as loadable modules (.so)]
 –enable-logio
[enable mod_logio: input and output logging]
 –enable-deflate
[enable mod_deflate: deflate transfer encoding support]
 –enable-ssl
[enable mod_ssl: SSL/TLS support]
 –with-z=DIR
[use a specific zlib library (mod_deflate)]
[if user built zlib using our Guide (installing to /usr/local) — DIR=/usr/local]
 –with-ssl=DIR
[use a specific SSL/TLS toolkit (OpenSSL)]
[if user built openssl using our Guide (installing to /usr/local/ssl) — DIR=/usr/local/ssl]
[sanity check] Generated Output
Verify that the configuration proccess has detected and enabled mod_ssl and mod_deflate correctly…
mod_deflate…
checking whether to enable mod_deflate… checking dependencies
adding “-I/usr/local/include” to INCLUDES
adding “-L/usr/local/lib” to LDFLAGS
setting LIBS to “-lz”
checking for zlib library… found
checking zutil.h usability… yes
checking zutil.h presence… yes
checking for zutil.h… yes
checking whether to enable mod_deflate… shared (all)
mod_ssl…
checking whether to enable mod_ssl… checking dependencies
checking for SSL/TLS toolkit base… /usr/local/ssl
checking for SSL/TLS toolkit version… OpenSSL 0.9.8c 05 Sep 2006
checking for SSL/TLS toolkit includes… /usr/local/ssl/include
checking for SSL/TLS toolkit libraries… /usr/local/ssl/lib
adding “-I/usr/local/ssl/include/openssl” to INCLUDES
adding “-I/usr/local/ssl/include” to INCLUDES
adding “-L/usr/local/ssl/lib” to LDFLAGS

checking whether to enable mod_ssl… shared (all)
Build and Install
Before proceeding with make…
Make sure files ‘libcrypto.so.0.9.8’ and ‘libssl.so.0.9.8’ have been symlinked or copied from ‘/usr/local/ssl/lib’ to ‘/lib’. This library location seems to be hardcoded for these libs under httpd make build.
If these files are not present, make will fail with message…
./dftables: error while loading shared libraries: libssl.so.0.9.8: cannot open shared object file: No such file or directory
make[3]: *** […/httpd-2.0.59/srclib/pcre/chartables.c] Error 127
Build and Install Apache…
 …httpd-2.0.59]# make
 …httpd-2.0.59]# make install
[sanity check] Runtime Linker
Verify that binary ‘httpd’ is linking against the correct zlib and ssl libraries…
…]# ldd /usr/local/httpd-2.0.59/bin/httpd
 libz.so.1 => /usr/local/lib/libz.so.1 …
 libssl.so.0.9.8 => /lib/libssl.so.0.9.8 …
 libcrypto.so.0.9.8 => /lib/libcrypto.so.0.9.8 …

##### Apache2 #####

cd httpd-2.0.59

./configure –prefix=/usr/local/apache –enable-so –with-mysql=/usr/local/mysql –enable-cgi –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 ..

##### 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 ..

安装这版本的时候可能会出现MySQL client library is not bundled
所以可以到www.mysql.com下载一个对应的mysql二进制版本,如mysql-standard-4.1.18-pc-linux-gnu-i686.tar.gz,解压cp到/usr/local/mysql-standard,然后

##### PHP #####
cd php-5.2.0

./configure –prefix=/usr/local/php5 –with-apxs2=/usr/local/apache/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=/usr/local/mysql-standard –with-iconv –with-mbstring –enable-mbstring=all –enable-track-vars –enable-force-cgi-redirect –enable-ftp –with-openssl=/usr/local/ssl –with-openssl-dir=/usr/local/ssl –with-pear=/usr/local/php5/pear –with-xml –enable-so –enable-shared

make
make install

cp php.ini-dist /usr/local/apache/conf/php.ini
cd ..

##### PHP #####

cd php-4.4.4

./configure –prefix=/usr/local/php4 –with-apxs2=/usr/local/apache/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=/usr/local/mysql –with-mysql-sock=/tmp/mysql.sock –with-iconv –with-mbstring –enable-mbstring=all –enable-track-vars –enable-force-cgi-redirect –enable-ftp –with-openssl=/usr/local/ssl –with-openssl-dir=/usr/local/ssl –with-pear=/usr/local/php/pear –with-xml –enable-so –enable-shared

make
make install

cp php.ini-dist /usr/local/apache/conf/php.ini
cd ..

Apache 2.0.55 无法加载 libphp5.so 模块
chcon /usr/local/apache2/modules/libphp5.so -t shlib_t

5编辑APACHE2配置文件
使得APACHE2能够启动PHP模块:
APACHE2的配置文件应该在/usr/local/apache2/conf/httpd.conf
打开他,在最下面加入LoadModule php5_module modules/libphp5.so
注意:如果上面已经有了 就不用加了

使得APACHE2能对以.php结尾的地址进行识别
加入AddType application/x-httpd-php .php

openssl自建证书SSL+apache

作者: cckj 发布日期: 2006-5-10 查看数: 1180 出自: http://www.linuxsky.net

作者:wingger 出处:CU

本文章在LINUX9+apache2.0.52,tomcat5.5.6,j2se1.5,openssl0.97上实验通证
本文的目的是为了交流,如有出错的地方,请指教
转载请注明出处,并保持文章的完整性
现在开始安装

首先在安装之前要明白一些基本概念

1、SSL所使用的证书可以是自己建的生成的,也可以通过一个商业性CA如Verisign 或 Thawte签署证书。

2、证书的概念:首先要有一个根证书,然后用根证书来签发服务器证书和客户证书,一般理解:服务器证书和客户证书是平级关系。在SSL必须安装根证书和服务器证书来认证。

因此:在此环境中,至少必须有三个证书:即根证书,服务器证书,客户端证书
在生成证书之前,一般会有一个私钥,同时用私钥生成证书请求,再利用证书服务器的根证来签发证书。

3、签发证书的问题:我最近找了很多关于openssl的资料,基本上只生成了根证书和私钥及服务器证书请求,并没有真正的实现签证。我这里参考了一些资料,用openssl自带的一个CA.sh来签证书,而不是用MOD_ssl里的sign.sh来签。

用openssl语法来生成证书,有很多条件限定,如目录,key的位置等,比较麻烦,我实验了好几天,最后放弃了。有兴趣的可以参考一下openssl手册。

步骤一:安装openssl和apache
1、到www.openssl.org下载openssl-0.9.7e.tar.gz(目前最新版)
2、卸载掉老的opensll库
CODE:
#rpm –e –-nodeps openssl

3、解压:
CODE:
#tar xzvf openssl-0.9.7e.tar.gz

4、进入openssl目录,并安装,用–prefix指定openssl安装目录
CODE:
#cd openssl-0.9.7e
#./config –prefix=/usr/local/openssl
#make
#make test
#make install

5、安装apache
至www.apache.org/dist下载apache最新版httpd-2.0.52.tar.gz
解压后进入apache目录,根据需要安装需要的模块,我这里装了ssl,rewrite,动态模式安装
CODE:
#tar zxvf httpd-2.0.52.tar.gz
#cd httpd-2.0.52
#./configure –prefix=PREFIX –enable-ssl –enable-rewrite –enable-so –with-ssl=/usr/local/openssl
#make
#make install

步骤二:签证
安装openssl后,在openssl下有一个CA.sh文件,就是利用此文件来签证,
来签三张证书,然后利用这三张证书来布SSL服务器。

1、在/usr/local/apache/conf下,建立一个ssl.crt目录,将CA.sh文件copy至/usr/local/apache/conf/ssl.crt/目录
CODE:
[root@win ssl]# cp /usr/local/openssl/ssl/misc/CA.sh /usr/local/apache/conf/ssl.crt/CA.sh

2、运行CA.sh -newca,他会找你要CA需要的一个CA自己的私有密钥密码文件。如果没有这个文件?按回车会自动创建,输入密码来保护这个密码文件。之后会要你的一个公司信息来做CA.crt文件。最后在当前目录下多了一个./demoCA这样的目录../demoCA/private/cakey.pem就是CA的key文件啦,./demoCA/cacert.pem就是CA的crt文件了
CODE:
[root@win ssl.crt]# ./CA.sh -newca

要求输入如下信息:
QUOTE:
Country Name (2 letter code) [GB]:CN
State or Province Name (full name) [Berkshire]:FUJIAN
Locality Name (eg, city) [Newbury]:FUZHOU
Organization Name (eg, company) [My Company Ltd]:FJJM
Organizational Unit Name (eg, section) []:FD
Common Name (eg, your name or your server’s hostname) []:WIN
Email Address []:WIN@WIN.COM

这样就建好了一个CA服务器,有了一个根证书的私钥cakey.pem及一张根证书cacert.pem,现在就可以cacert.pem来给签证了

3、签署服务器证书
生成服务器私钥:
CODE:
[root@win ssl.crt]# openssl genrsa -des3 -out server.key 1024

生成服务器证书请求
CODE:
[root@win ssl.crt]# openssl req -new -key server.key -out server.csr

会要求输入信息
CODE:
Country Name (2 letter code) [GB]:CN
State or Province Name (full name) [Berkshire]:FUJIAN
Locality Name (eg, city) [Newbury]:FUZHOU
Organization Name (eg, company) [My Company Ltd]:FJJM
Organizational Unit Name (eg, section) []:FD
Common Name (eg, your name or your server’s hostname) []:WIN
Email Address []:WIN@WIN.COM
Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:WIN
An optional company name []:WING

最后把server.crt文件mv成newreq.pem,然后用CA.sh来签证就可以了
CODE:
[root@win ssl.crt]# mv server.csr newreq.pem
[root@win ssl.crt]# ./CA.sh -sign

这样就生成了server的证书newcert.pem
把newcert.pem改名成server.crt
CODE:
[root@win ssl.crt]# mv newcert.pem server.crt

4、处理客户端:
生成客户私钥:
CODE:
[root@win ssl.crt]# openssl genrsa -des3 -out client.key 1024

请求
CODE:
[root@win ssl.crt]# openssl req -new -key client.key -out client.csr

签证:
CODE:
[root@win ssl.crt]# openssl ca -in client.csr -out client.crt

把证书格式转换成pkcs12格式
CODE:
[root@win ssl.crt]# openssl pkcs12 -export -clcerts -in client.crt -inkey client.key -out client.pfx

5、这时就有了三张证书和三个私钥,一个是demoCA下的根证书,ssl.crt下的服务器证书和客户证书。及demoCA/private下的根key,ssl.crt下的服务器key和客户key,在conf下的ssl.conf下指定证书的位置和服务器key的位置.

我是在conf下建立一个ssl.crt目录,并将所有的key和证书放到这里
CODE:
#cp demoCA/cacert.pem cacert.pem

同时复制一份证书,更名为ca.crt
CODE:
#cp cacert.pem ca.crt

步骤三、编辑ssl.conf
CODE:
#cd /usr/local/apache/conf

编辑ssl.conf
CODE:
指定服务器证书位置
SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt
指定服务器证书key位置
SSLCertificateKeyFile /usr/local/apache/conf/ssl.crt/server.key
证书目录
SSLCACertificatePath /usr/local/apache/conf/ssl.crt
根证书位置
SSLCACertificateFile /usr/local/apache/conf/ssl.crt/cacert.pem
开启客户端SSL请求
SSLVerifyClient require
SSLVerifyDepth 1

启动ssl
CODE:
/usr/local/apache/bin/apachectl startssl

会要求输入server.key的密码
启动,这样一个默认的SSL服务器及http服务器就启动了,

步骤四、安装和使用证书
把刚才生成的证书:根证书ca.crt和客户证书client.pfx下到客户端,并安装,
ca.crt安装到信任的机构,client.pfx直接在windows安装或安装到个人证书位置,然后用IP访问HTTP和https服务器。

      站点地图 | 关于我 | 返回顶部
    Copyright © 2001-2013 { amiku.cn | zhangshunjin.com }. Powered by 

    阿米酷

    张顺金


    浙ICP备11002820号-1