non-DSO:
$ SSL_BASE=../openssl-0.9.5a RSA_BASE=../rsaref-2.0/local
./configure --prefix=/apache --with-layout=chroot
--enable-module=most --enable-module=so --enable-module=ssl
--disable-rule=SSL_COMPAT --enable-rule=SSL_SDBM
--activate-module=src/modules/php4/libphp4.a
--activate-module=src/modules/perl/libperl.a
DSO:
$ cd src/modules
$ make clean ## seems to be necessary if you previously compiled in the apache tree
$ cd ../../
$ SSL_BASE=../openssl-0.9.5a RSA_BASE=../rsaref-2.0/local
./configure --prefix=/apache --with-layout=chroot
--enable-module=most --enable-shared=max --enable-shared=ssl
--disable-rule=SSL_COMPAT --enable-rule=SSL_SDBM
$ make
8.7 重新安装Apache。如果他在运行,要停止运行再安装。
ROOT# chroot /www /apache/bin/apachectl stop
ROOT# make install ## I am root!
8.8 对于non-DSO安装你可以检测内部编译模块。
ROOT# chroot /www /apache/bin/httpd -l | grep -E '(php|perl|ssl)'
mod_ssl.c
mod_php4.c
mod_perl.c
8.9 在实现了虚拟根环境目录树中生成随机的设备
ROOT# cd /www/dev
ROOT# mknod random c 1 8
ROOT# mknod urandom c 1 9
8.10 将缺省配置文件融合到你当前的httpd.conf文件中。
我在不同于标准端口(80端口)的其他端口上进行了测试,但是对于安全端口(443端口),没有web服务起跑再它上面,所以我马上就会用一下这个端口。
在这个例子中,我对缺省的配置文件httpd.conf的一些修改如下:
User www
Group www
ServerName yourserver.yourdomain.here
Port 8088 ## pick a test port
Listen 8088 ## in 'IfDefine SSL' section
Listen 443 ## this is the standard secure port!
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# your Hello.pm script for mod_perl testing:
SetHandler perl-script
PerlHandler Apache::Hello
SSLCertificateFile /apache/conf/server.crt
SSLCertificateKeyFile /apache/conf/server.key
# in this example I generate the key and crt files into /apache/conf
8.11 如果你现在还没有一个服务器的关键字(keys)和认证(certficate),那么现在就生成它。
在这个例子中我假设openssl在你的路径中,因为你已经安装了它。如果没有,你就把它加到路径中。注意,我已经认定了我的关键字,如果你要做非常重要的事,你最好利用授权机制来分发这些关键字。
ROOT# cd /www/apache/conf
set up a path of random files(为random文件生成路径)
ROOT# randfiles='/var/log/messages:/proc/net/unix:/proc/stat:/proc/ksyms'
generate the server key(产生服务端的密钥)
ROOT# openssl genrsa -rand
$randfiles -out server.key 1024
产生带签名的请求(在认证自己的时候不要加密码)
注意你的Common Name必须匹配你完全有权访问的web server name
ROOT# openssl req -new -nodes -out request.pem -key server.key
签上你自己的密钥(有效期一年)
ROOT# openssl x509 -in request.pem -out server.crt -req -signkey server.key -days 365
保护你的密钥和证书
ROOT# chmod 400 server.*
| 论坛热门帖子: | [lch203] 写得蛮好的linux学习笔记(10-21) [黑马制造] 学习java的30个目标(10-19) [笑傲股林] 做测试半年了,有点迷茫,应该再学些什么提高自己的测试水平和测试能力呢?(10-19) [udp8589] 大家用google的来吱一声? 用百度的~~也来报道下?(10-18) [沂偌掳兆] 本人总结的一些认为C++比较经典的书籍,希望对大家有用(10-18) |
| TAG标签: | 虚拟 环境 建立 ROOT# 安装 文件 目录 Apache 一个 cd |
注册
个人空间
