1、访问端口配置
编辑F:\JBoss\server\default\deploy\jboss-web.deployer\server.xml将8080改为你希望访问的端口(8888) <Connector port="8080" address="${jboss.bind.address}" maxThreads="250" maxHttpHeaderSize="8192" emptySessionPath="true" protocol="HTTP/1.1" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" />
2、解决附件汉字问题:编辑F:\JBoss\server\default\deploy\jboss-web.deployer\server.xml在Connector 属性最后增加:URIEncoding="UTF-8"
<Connector port="8080" address="${jboss.bind.address}" maxThreads="250" maxHttpHeaderSize="8192" emptySessionPath="true" protocol="HTTP/1.1" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true"URIEncoding="UTF-8" /> 页面处理:将生成的附件名称进行编码转换 <% String n2="Redhat9中文官方文档.rar"; n2=java.net.URLEncoder.encode(n2,"UTF-8"); %> <a href="Redhat9">http://192.168.1.112:8080/zlsf/<%=n2%>">Redhat9中文官方文档</a>
3.禁止/打开文件目录列表编辑F:\JBoss\server\default\deploy\jboss-web.deployer\conf\web.xml禁止把listing设置为false,否则true
<servlet> <servlet-name>default</servlet-name> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <init-param><param-name>listings</param-name><param-value>false</param-value></init-param> <load-on-startup>1</load-on-startup> </servlet>
4、默认打开页配置:编辑F:\JBoss\server\default\deploy\jboss-web.deployer\conf\web.xml<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
5、防止LOG文件无限制的扩大在F:\JBoss\server\default\conf目录下打开jboss-log4j.xml文件,在下语句块下:<appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/> <param name="File" value="${jboss.server.log.dir}/server.log"/> <param name="Append" value="false"/>增加以下语句:<param name="MaxFileSize" value="10240KB"/> <param name="MaxBackupIndex" value="1"/> 其中文件的最大值和备份的数量可以根据实际情况而改变扩展配置: <Valve className="org.apache.catalina.valves.AccessLogValve" prefix="localhost_access_log." suffix=".log" pattern="combined" directory="${jboss.server.log.dir}" resolveHosts="false" />
6、虚拟目录配置:编辑F:\JBoss\server\default\deploy\jboss-web.deployer\server.xml在 </Host>之前增加:
<Context path="/test" docBase="F:\\test" debug="1" reloadable="true" override="true" crossContext="true"/>其中path 为虚拟目录名,docBase为硬盘路径(可为绝对路径)reloadable为类变更时是否重新加载。7、运行run.bat来启动JBoss 关闭JBoss:关闭JBoss的DOS窗口或按"CTRL + C"原文出处:
扩展: IP访问:address="${jboss.bind.address}" 改为 address="${0.0.0.0}host配置:<Host name="localhost" autoDeploy="false" deployOnStartup="false" deployXML="false" configClass="org.jboss.web.tomcat.security.config.JBossContextConfig"> </Host> <Host name="" autoDeploy="false" deployOnStartup="false" deployXML="false" configClass="org.jboss.web.tomcat.security.config.JBossContextConfig"> <Alias>127.0.0.1</Alias> <Alias>www.new.com</Alias> <Valve className="org.apache.catalina.valves.AccessLogValve" prefix="localhost_access_log." suffix=".log" pattern="combined" directory="${jboss.server.log.dir}" resolveHosts="false" /> <!-- docBase:项目路径名 xuchao 项目名 --> <Context path="/" docBase="/www/project" reloadable="true" override="true" crossContext="true"/> <Valve className="org.jboss.web.tomcat.service.jca.CachedConnectionValve" cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager" transactionManagerObjectName="jboss:service=TransactionManager" /> </Host>