Apache+WebSphere服务器部署方案版本号:V1.12011年9月Page1of25目录重要提示...........................................................................................................................................21Linux安装...............................................................................................................................21.1安装全部程序...........................................................................................................21.2安装源设置...............................................................................................................22Apache安装.............................................................................................................................32.1准备安装...................................................................................................................32.2安装ApacheWebServer..........................................................................................32.3验证安装...................................................................................................................42.4编译代理/反向代理模块..........................................................................................52.5配置代理/反向代理模块..........................................................................................62.6创建配置文件crossdomain.xml..............................................................................82.7Apache中文乱码问题解决......................................................................................82.8配置RewriteRule..................................................................................................113Was7Plugin安装...................................................................................................................113.1Websphere常用命令..............................................................................................123.2JDNI配置...............................................................................................................123.3应用服务器单机版配置.........................................................................................163.4应用服务器集群版配置.........................................................................................164常见问题.................................................................................................................................234.1环境问题.................................................................................................................234.2应用问题.................................................................................................................24Page2of25重要提示Web服务器包括apache的安装部署和WAS7Plugin安装部署两部分,如果的websphere应用服务器使用非集群模式,plugin则不需要安装,只需配置本文2.1章节内容,如果websphere应用服务器使用群集模式,则需要按照本文2.2章节进行plugin安装配置。1Linux安装1.1系统安装1.根分区磁盘容量应大于20G2.推荐安装所有应用程序1.2安装源设置图中黑色边框指示设置系统安装源,尤其在服务器无法连接外网时需要使用光盘作为安装源Page3of252Apache安装2.1准备安装关闭系统自带的web服务:#chkconfighttpdoff安装gcc(适用于系统没有安装gcc时)#yuminstallgcc*(yuminstallgcc-c++libstdc++-devel)出现y/n提示时,输入y下载并解压安装程序:#cd~/#wget–zxvfhttpd-2.2.15.tar.gz-C/usr/src把包解压到/usr/src2.2安装ApacheWebServer进入源码目录:#cd/usr/src/httpd-2.2.15配置编译文件:#./configure--prefix=/opt/apache--enable-so--enable-mods-shared=most--with-mpm=worker编译文件:#makePage4of25安装程序:#makeinstall2.3验证安装进入安装后目录:#cd/opt/apache/检查进程模式:#./apachectl–lCompiledinmodules:core.cworker.chttp_core.cmod_so.c启动ApacheWebServer:#./apachectlstart打开浏览器,输入webserver地址,出现如下界面表示apache安装成功。停止ApacheWebServer:#./apachectlstopPage5of252.4编译代理/反向代理模块进入源码目录:#cd/usr/src/httpd-2.2.15/modules/proxy生成mod_proxy.so:#/opt/apache/bin/apxs-i-a-cmod_proxy.cproxy_util.c生成mod_proxy_http.so:#/opt/apache/bin/apxs-i-a-cmod_proxy_http.c编译生成缓存模块:#cd/usr/src/httpd-2.2.15/modules/cache生成mod_cache.c:#/opt/apache/bin/apxs-i-a-cmod_cache.ccache_util.ccache_cache.ccache_storage.ccache_pqueue.ccache_hash.c生成mod_mem_cache.so:#/opt/apache/bin/apxs-i-a-cmod_mem_cache.c生成mod_dist_cache.so:#/opt/apache/bin/apxs-i-a-cmod_disk_cache.c生成mod_file_cache.c:#/opt/apache/bin/apxs-i-a-cmod_file_cache.c检查httpd.conf配置文件:#cat/opt/apache/conf/httpd.confPage6of25重新启动Apache#/opt/apache/bin/apachectlstart2.5配置代理/反向代理模块httpd.conf中添加如下:###防止中间的防火墙杀掉不活动的连接,设定keepalive=OnProxyRequestsOffProxy*Orderdeny,allow#DenyfromallAllowfromall/Proxy####下面两行是配置反向代理#作用:跳转到://://下面是配置缓存IfModulemod_mem_cache.cCacheEnablemem/xsm2/CacheLastModifiedFactor1.0#默认缓存有效期(秒)#CacheDefaultExpire3600#缓存允许使用的最大内存量,以KB为单位MCacheSize2048000#最大缓存对象数MCacheMaxObjectCount30000#允许缓存的最小文档大小(字节)MCacheMinObjectSize1#缓存允许的最大文档大小(字节)MCacheMaxObjectSize10240000/IfModule####下面是配置客户端缓存Location/xsm2#启用有效期控制ExpiresActiveOn#swf文档的有效期是最后修改时刻后的(单位秒)ExpiresByTypeapplication/x-shockwave-flashA43200#html文档的有效期是最后修改时刻后的十二小时#注意应用系统使用html模板时,要将此行注释,否则html模板被缓存ExpiresByTypetext/htmlA43200#xml文档的有效期是最后修改时刻后的十二小时ExpiresByTypeapplication/xmlA43200#xml文档的有效期是最后修改时刻后的十二小时Page8of25ExpiresByTypetext/xmlA4