需求:get時編碼有問題,域名配置 前端
最新版本配置更簡單了,後面得方法再也不使用,最新方法直接貼代碼,本身體會 nginx
<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>
解決: web
問題一:注意位置:<system-properties>...</system-properties>要放在</extensions>和<management> apache
<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>
問題二: websocket
1)找到 <socket-binding name="http" port="8080"/>改端口爲80 dom
2)設置A.war中web訪問根目錄: socket
將standalong.xml中<virtual-server>標籤的屬性enable-welcome-root="true"設置爲false.而後在應用程序**.war/WEB-INF下添加jboss-web.xml文件 jsp
內容爲: ide
<?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; }