Address: http://my.oschina.net/u/171502/blog/32126
Function: You can use different port numbers to access different web projects on a single jboss server. This prevents access to non-root projects from using ip addresses, port numbers, and project names.
Reference: http://my.oschina.net/xiaohong/blog/28151
Jboss server version: 4.2.2GA
Jboss directory structure:
Implementation principle: Start the Service Command run. bat on jboss \ bin to load the project in jboss \ server \ default by default. Now, run the default and demo file instances and bind different ports accordingly.
Load the default instance when accessing port 8080. Access Port 80 and load the demo instance.
Implementation process:
1. Copy the jboss \ server \ default file in the current directory, and rename the directory as: demo
2. In the jboss \ server \ demo \ conf \ jboss-service.xml file, query
<Mbean code = "org. jboss. services. binding. ServiceBindingManager"
Name = "jboss. system: service = ServiceBindingManager">
<Attribute name = "ServerName"> ports-01 </attribute>
<Attribute name = "StoreURL" >$ {jboss. home. url}/docs/examples/binding-manager/sample-bindings.xml </attribute>
<Attribute name = "StoreFactoryClassName">
Org. jboss. services. binding. XMLServicesStoreFactory
</Attribute>
</Mbean>
Remove comments and modify the name = ServerName values, including posts-default, posts-01, posts-02, and posts-03.
Currently, posts-01 is used.
The port value for the sample-bindings.xml can be queried in the jboss \ docs \ examples \ binding-manager \ ports-0X (if the file does not exist, copy the same version to the appropriate directory ).
3. Modify the default port of the project:
Modify the default access port for instance demo in jboss \ server \ demo \ deploy \ jboss-web.deployer \ server. xml:
<Connector port = "80" address = "0.0.0.0"
MaxThreads = "250" maxHttpHeaderSize = "8192"
EmptySessionPath = "true" protocol = "HTTP/1.1"
EnableLookups = "false" redirectPort = "8443" acceptCount = "100"
ConnectionTimeout = "20000" disableUploadTimeout = "true"/>
The default port of the instance is 8080;
4. Run the project (in windows)
1. Run the doc command in windows, enter the jboss \ binfile, and then execute
#./Run. bat-c demo &
You can use port 80 to access the project in the cvc file.
2. run. bat in the doc.
You can use 8080 to access projects in the default instance.
5. Solution to stop the jboss service when the ssh connection is used but the connection is disconnected (in linux ):
Problem scenario: when starting a demo instance, enter the "./run. sh-c demo" command on the ssh console, but the instance cannot be accessed after ssh is disconnected.
Solution: When the instance is started, run "./run. sh-c demo &". After the command is run, run # exit. jboss will be run in the background. Now you can disconnect the ssh remote terminal window.