1、配置虚拟目录
在httpd.conf中,设置虚拟目录,同时还可以设置被允许或被禁止的ip等
Alias
/icons/ "/usr/ali/apache2/icons/" //
可以将htm之类的文件放在/usr/ali/apache2/icons/目录下, 外面通过
ip:port/icons来进行访问
<Directory "/usr/ali/apache2/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny //规定了allow和deny的出现顺序
Allow from all
</Directory>
<Directory "/usr/ali/apache2/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny //规定了allow和deny的出现顺序
Allow from all
</Directory>
外面就可以通过ip:port/
icons进行访问了. 同时可以添加Deny from 192.168.0.1等来阻止该ip对此虚拟目录的访问
2、添加SSL支持
3、Apache启动和停止
./apachectl stop
./apachectl start
./apachectl restart
参考刘加伟同学的规范如下
---------------------------------------------------------------
装机规范
- 操作系统统一使用rhel 5.3 64位 ,kernel为 2.6.18 [2.6.18-128.el5] (*小版本号码可变)
- yum install fonts-chinese.noarch 安装中文支持字体
- 调整系统ulimit 为10240 ,swap /proc/sys/vm/swappiness 为10
- 软件环境
- httpd-2.0.61 根据OS平台编译选定, 使用copy形式安装在/usr/alibaba/install
- jboss-4.0.5.GA 跟OS平台无任何关系, 使用copy形式安装/usr/alibaba/install
- jdk1.6.0_11 跟OS 32/64相关选定平台, 使用copy形式安装/usr/alibaba/install
- 软link 建立
- /usr/alibaba/httpd -> /usr/alibaba/install/httpd-2.0.61/
- /usr/alibaba/java -> /usr/alibaba/install/jdk1.6.0_11
- /usr/alibaba/jboss -> /usr/alibaba/install/jboss-4.0.5.GA/
- SA可以把以上软件纳入装机系统. (* 目前可能独立生成RPM包, 用yum安装)
- 中文站所有新装服务器按照此要求安装,并且生成自动安装系统完成安装任务
参数优化相关
搭建过程
1:apache
- wget http://archive.apache.org/dist/httpd/httpd-2.0.61.tar.gz
- tar -zxvf httpd-2.0.61.tar.gz
- 进入httpd-2.0.61,执行安装
- $ ./configure --prefix=/usr/alibaba/install/httpd-2.0.61 --enable-rewrite=static --with-mpm=worker --enable-so --enable-proxy --enable-proxy-http --enable-deflate
- $ make
- $ make install
2:mod_jk
- wget http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/source/jk-1.2.26/tomcat-connectors-1.2.26-src.tar.gz
- tar -zxvf tomcat-connectors-1.2.26-src.tar.gz
- 进入目录,native执行编译
- ./configure --with-apxs=/usr/alibaba/install/httpd-2.0.61/bin/apxs
- make
- cp apache-2.0/mod_jk.so ../../../install/httpd-2.0.61/modules/
3: 编译image module
- svn co http://svn.alibaba-inc.com/repos/ali_cn/commons/apache_module/ImgURIFilter/trunk/ ImgURIFilter
- 进入 ImgURIFilter 目录,直接make, 直接在目录下生成mod_ImgURLOutFilter.so,Makefile里默认指定的apache路径是/usr/alibaba/httpd
- cp mod_ImgURLOutFilter.so ../../install/httpd-2.0.61/modules/
4: module ali_beacon ali_cookie
- 向李建辉要以上两module的源码
- cp mod_aliBeacon.c /usr/alibaba/install/httpd-2.0.61
bin/apxs -c mod_aliBeacon.c
bin/apxs -a -i -n aliBeacon mod_aliBeacon.la
- cp mod_AliCookie(for\ apache2.x).c /usr/alibaba/install/httpd-2.0.61
bin/apxs -c mod_AliCookie(for\ apache2.x).c
编译报错:
apxs:Error: Command failed with rc=131072
重命名 mv mod_AliCookie(for\ apache2.x).c mod_AliCookie.c
bin/apxs -c mod_AliCookie.c
bin/apxs -a -i -n mod_AliCookie mod_AliCookie.la
5:jdk
- 下载包安装包:jdk-6u11-linux-x64.bin
- 进入install目录,执行 ./../software/jdk-6u11-linux-x64.bin
6: jai安装
- wget http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-linux-amd64-jdk.bin
wget http://download.java.net/media/jai-imageio/builds/release/1.1/jai_imageio-1_1-lib-linux-amd64-jdk.bin - 进入jdk安装目录,/usr/alibaba/install/jdk1.6.0_11
执行: ../../software/jai-1_1_3-lib-linux-amd64-jdk.bin
执行:../../software/jai_imageio-1_1-lib-linux-amd64-jdk.bin
7: 加密包
- svn co http://svn.alibaba-inc.com/repos/ali_cn/development/securitypatch/
- cp US_export_policy.jar /usr/alibaba/install/jdk1.6.0_11_x64/jre/lib/security/
cp local_policy.jar /usr/alibaba/install/jdk1.6.0_11_x64/jre/lib/security/
8: jboss
- wget http://nchc.dl.sourceforge.net/sourceforge/jboss/jboss-4.0.5.GA.zip
- cd /usr/alibaba/install
unzip ../jboss-4.0.5.GA.zip
9: 建软链接
- cd /usr/alibaba
ln -s install/httpd-2.0.61 httpd
in -s install/jdk1.6.0_11 java5 (目前发布环境的java指定目录)
in -s install/jdk1.6.0_11 java6
in -s install/jboss-4.0.5.GA jboss
本文转自 tianya23 51CTO博客,原文链接:http://blog.51cto.com/tianya23/312472,如需转载请自行联系原作者