需求:get时编码有问题,域名配置
最新版本配置更简单了,后面得方法不再使用,最新方法直接贴代码,自己体会
<subsystem xmlns="urn:jboss:domain:undertow:3.0"> <buffer-cache name="default"/> <server name="default-server"> <http-listener name="default" redirect-socket="https" socket-binding="http"/> <host name="default-host" default-web-module="online.war" alias="localhost pinqidesign.com"/> </server> <servlet-container name="default"> <jsp-config/> <websockets/> </servlet-container> </subsystem> //另外在 online.war的WEB-INF下 <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd"> <jboss-web> <context-root>/</context-root> <virtual-host>default-host</virtual-host> </jboss-web>
解决:
问题一:注意位置:<system-properties>...</system-properties>要放在</extensions>和<management>
<system-properties> <property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/> <property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/> </system-properties>
问题二:
1)找到 <socket-binding name="http" port="8080"/>改端口为80
2)设置A.war中web访问根目录:
将standalong.xml中<virtual-server>标签的属性enable-welcome-root="true"设置为false.然后在应用程序**.war/WEB-INF下添加jboss-web.xml文件
内容为:
<?xml version="1.0" encoding="UTF-8"?> <jboss-web> <context-root>/</context-root> </jboss-web>
3)本地测试怎么模拟IP地址呢?在win7里添加一个虚拟网卡,再TCP/IP的高级设置里ip地址里添加IP,地址使用要模拟的ip地址,子网掩码使用局域网默认就可以。模拟域名呢?hosts文件。
4)standalone.xml中的配置
<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"/> <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/> <virtual-server name="default-host" enable-welcome-root="false"> <alias name="localhost"/> <alias name="example.com"/> </virtual-server> </subsystem>
中添加
<virtual-server name="openebc" default-web-module="blog.war"> <alias name="openebc.com"/> </virtual-server>
default-web-module属性指向的war包名字,也可以省略.war。应用程序**.war/WEB-INF下jboss-web.xml文件中5)添加<virtual-host>openebc.com</virtual-host>,virsual-host的值是和visual-server的name属性对应的,添加后文件如下:
<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd"> <jboss-web> <context-root>/</context-root> <virtual-host>openebc</virtual-host> </jboss-web>
问题三:nginx作为前端配置,这时不需要修改端口为80,是通过Nginx80端口收到信息后反向代理到jboss.
whpe.com配置:
server{
listen 80;
server_name www.whpe.com;
location / {
proxy_pass http://localhost:8080;
}
}
server{
listen 80;
server_name whpe.com;
rewrite ^/(.*) http://www.whpe.com/$1 permanent;
}