jboss1.7中配置域名直接访问
在jboss中做域名解析可分为如下几步:
1、先将域名解析到对应的服务器的ip
2、Jboss 虚拟主机设置:在对应服务器的jboss下的项目的web-inf中添加jboss-web.xml文件:
文件中做如下配置:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/</context-root>
</jboss-web>
3、修改jboss-as-7.1.1.Final\standalone\configuration下的standalone.xml中的配置:
(1)、找到这段配置( <virtual-server name="default-host" enable-welcome-root="true">里面的true要改为false)
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
</subsystem>
(2)、将上面配置改为如下配置:(www.abc.com是域名 :这样配置的结果是:在浏览器上输入abc.com可以访问,但输入www.abc.com不可以访问)
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="false">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
<virtual-server name="www.abc.com" default-web-module="blog">
<alias name="www.abc.com" />
</virtual-server>
</subsystem>
(3)、将上面配置改为如下配置:(abc.com是域名 :这样配置的结果是:在浏览器上输入www.abc.com可以访问,但输入abc.com不可以访问)
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="false">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
<virtual-server name="abc.com" default-web-module="blog">
<alias name="abc.com" />
</virtual-server>
</subsystem>
(4)、将上面配置改为如下配置:(这样配置的结果是:在浏览器上输入www.abc.com或者abc.com都可以访问)
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="false">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
</subsystem>
问题描述:jboss上部署的项目,能通过localhost和127.0.0.1访问,但不能通过本地ip访问
找到将jboss-as-7.1.1.Final\standalone\configuration下的standalone.xml中的如下配置:
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>
改为:
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:0.0.0.0}"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>
jboss相关问题:http://www.360doc.com/content/12/1128/16/203871_250774161.shtml
本文详细介绍了在JBoss中配置域名解析的方法,包括将域名解析到服务器IP,设置虚拟主机,修改配置文件等步骤,确保通过域名可以直接访问部署的项目。

7191

被折叠的 条评论
为什么被折叠?



