Apache+Jboss 完成二级域名

<!-- [if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><!-- [if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing> <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery> <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:SpaceForUL/> <w:BalanceSingleByteDoubleByteWidth/> <w:DoNotLeaveBackslashAlone/> <w:ULTrailSpace/> <w:DoNotExpandShiftReturn/> <w:AdjustLineHeightInTable/> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:UseFELayout/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!-- [if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!-- [if !mso]> <object classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui> </object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><!-- [if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:普通表格; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]-->

Apache+Jboss    完成二级域名

 

1. 安装 apache

              apache 的官网下载 apache 我用的版本是 apache-2.2.17. 解压之后,运行,然后访问浏览器, http://localhos/ 出现 It works 则表名安装成功。(注: apache 的默认端口是 80

例如:我安装的目录为: D:\Program Files\Apache Software Foundation\Apache2.2\ 安装之后他会自己启动。并且在右下角会出现如图所示 这个就是 apache 显示成功启动了。

 

 

2. 安装 jboss

              www.jboss.org 官网上下载 jboss 。解压直接使用即可。默认的端口号为: 8080

例如: D:\tools\jboss-5.1.0.GA  这个是我安装的目录。启动如下:

<!-- [if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><!-- [if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing> <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery> <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:SpaceForUL/> <w:BalanceSingleByteDoubleByteWidth/> <w:DoNotLeaveBackslashAlone/> <w:ULTrailSpace/> <w:DoNotExpandShiftReturn/> <w:AdjustLineHeightInTable/> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:UseFELayout/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!-- [if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!-- [if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:普通表格; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]-->

 

3. 下载 apache 集成插件 mod-jk.so

        该插件是 apache 的。直接到 apache 官网上下载即可。

4. 集成步骤

              4.1 开始集成。下载到本地后,直接将 .so 的文件修改为 mod-jk.so ,然后放到 D:\Program Files\Apache Software Foundation\Apache2.2\modules 文件夹下面

 

              4.2 打开 apache httpd.conf D:\Program Files\Apache Software Foundation\Apache2.2\conf 下)文件。修改如下内容:

打开如下文件

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_http_module modules/mod_proxy_http.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule vhost_alias_module modules/mod_vhost_alias.so

添加首页

<IfModule dir_module>

    DirectoryIndex index.html index.htm index.jsp

</IfModule>

 

包含如下文件:

Include conf/extra/httpd-vhosts.conf

# 编辑 apache conf/httpd.conf 文件 , 保证 apache 加载 jk_mod 文件(该文件需要自己创建)

Include conf/mod-jk.conf

              4.3 mod-jk.conf 的文件内容如下:

# 指出以下 mod_jk 模块的位置

LoadModule jk_module modules/mod_jk.so

 

# 指出以下 mod_jk 模块工作所需要的工作文件 workers.properties 的位置

JkWorkersFile conf/workers.properties

 

# 指出 mod_jk 模块的日志输出位置

JkLogFile logs/mod_jk.log

 

# 设置 mod_jk 模块的日志级别 [debug/error/info]

JkLogLevel error

 

# 设置 mod_jk 模块的日志格式

JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

 

# JkOptions indicate to send SSL KEY SIZE,

JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

 

# JkRequestLogFormat set the request format

JkRequestLogFormat "%w %V %T"

 

# 将所有对特定文件或目录的请求通过 ajp13 的协议送给 JBoss, JBoss 服务器来处理

JkMount /* loadbalancer

#JkMount /web-console/* loadbalancer

#JkMount /jmx-console/* loadbalancer

 

# 将所有拦截的请求 , Apache 服务器来处理

JkUnMount /*.jpg loadbalancer

JkUnMount /*.gif loadbalancer

JkUnMount /*.swf loadbalancer

JkUnMount /*.bmp loadbalancer

JkUnMount /*.png loadbalancer

 

                     4.4 打开 D:\Program Files\Apache Software Foundation\Apache2.2\conf\extra 文件下的 httpd-vhosts.conf 文件:配置虚拟主机:

<VirtualHost *:80>

    DocumentRoot "D:\tools\jboss-5.1.0.GA\server\default\deploy\sichuanmade war"  --

    ServerAdmin zouly@meyacom.com

    ServerName sichuanmade.com

    ServerAlias *.sichuan.com

    DirectoryIndex index.jsp

 

    # 通过 80 端口来访问

    JkMount /* loadbalancer

    # JkMount /jmx-console/* loadbalancer

    # JkMount /web-console/* loadbalancer

 

    # 实现泛解配置信息

    RewriteEngine On

 

    # 配置为 www 打头就不去 URL 重写

    RewriteCond %{HTTP_HOST} !^(www)\.sichuanmade \.com$

 

    # 实现动态解析

    RewriteCond %{HTTP_HOST} ^[a-z0-9\-]+\.apache\.com$

    RewriteRule ^/?$ /%{HTTP_HOST} [NC]

    RewriteRule ^/([a-z0-9\-]+)\.apache\.com/?$ http://sichuanmade.com /index.jsp [P,L]

 

    ErrorLog "logs/sichuanmade.com-error.log"

    CustomLog "logs/sichuanmade.com-access.log" common

 

</VirtualHost>

 

 

5. 测试搭建效果

                     重新启动 apache ,启动成功,然后访问 http://sichuanmade.com 即可。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值