阅 读 文 章

Linux和Solaris建立Apache的虚拟根环境

[来源:网上转载 () | 作者:网友() | 时间:2007-07-07 | 浏览:人次 ]

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

最新评论 共有0位网友发表了评论

发表评论

评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名:(注册)
密码:
验证码:
匿名发表

网站地图友情连接交流论坛网站投稿广告服务联系我们留言本站长统计
Some rights reserved: www.chmhome.com, 鄂ICP备07010232号 E-mail:chinakafei@live.com,QQ:552766
中国咖啡技术网(Chmhome):国外编程技术书籍,中文编程手册,经典编程文章,交流技术,技术软件下载,计算机论文,毕业论文.