Deploying Jboss5 in RedHatLinux denies direct access using ip addresses

Source: Internet
Author: User
Requirement: replace the old user center with the user center developed in java recently. The environment Used for program development and testing is Tomcat 6, and jboss is used when it is planned to be deployed to the online environment, the main reason for jboss's support for hot deployment is that the user prompts 403 permission denied when using an ip address for access (this abnormal requirement is mainly caused by data center management, it is mainly for port 80). When using a domain name for access, the normal application environment is displayed. Introduction: Operating System: RedHatEnterpriseLinux5.464 bits

Requirements:
The old user center should be replaced with the user center developed in java recently. The environment Used for program development and testing is Tomcat 6, and jboss should be used when it is planned to be deployed to the online environment, the main reason for jboss's support for hot deployment is that the user prompts 403 permission denied when using an ip address for access (this abnormal requirement is mainly caused by data center management, mainly for port 80). When using the domain name for access, the application is displayed as normal.

Environment Introduction:
Operating System: RedHat Enterprise Linux 5.4 64-bit
System ip Address: 192.168.50.7/24
Apache + mod_jk + jboss
Apache version: 2.2.16
Mod_jk version: 1.2.31
Jboss version: jboss5.1 GA
Note: We have previously considered using a virtual host directly on jboss. However, when using an ip address or a domain name for access, 404 is displayed without log information; considering that only one user center application is deployed on the jboss container,
Therefore, the jboss virtual host is abandoned. If other java applications need to be deployed in the future, you can deploy multiple jboss instances on one server and listen to different ports.

 
  1. 1: Compile and install apache2.2.16
  2. Wget http://archive.apache.org/dist/httpd/httpd-2.2.16.tar.gz-P/usr/local/src/tarbag
  3. Tar-zxvf/usr/local/src/tarbag/httpd-2.2.16.tar.gz-C/usr/local/src/software
  4. Cd/usr/local/src/software/httpd-2.2.16 &
  5. ./Configure-- Prefix=/Usr/local/apache2.2.16 -- enable-so -- enable-rewrite -- enable-headers-- With-mpm=Worker-- Enable-expires-- Enable-mod-shared=All
  6. Make & make install
  7.  
  8. 2: download and install jboss, which must be supported by java
  9. Java can be found on java.com
  10. Chmod u + x jdk-6u17-linux-i586.bin
  11. /Jdk-6u17-linux-i586.bin
  12. Mv jdk1.6.0 _ 17/usr/local/java
  13.  
  14. Vi/etc/profile Add the following content to the end of the file
  15. ExportJAVA_HOME=/Usr/local/java
  16. CLASSPATH=/Usr/local/java/lib/dt. jar:/usr/local/java/lib/tools. jar
  17. PATH=/Usr/local/java/bin: $ PATH
  18. Export PATH JAVA_HOME CLASSPATH
  19.  
  20. Source/etc/profile
  21. Wget http://nchc.dl.sourceforge.net/project/jboss/JBoss/JBoss-5.1.0.GA/jboss-5.1.0.GA.zip
  22. Unzip jboss-5.1.0.GA.zip-d/usr/local/
  23. Mv/usr/local/jboss-5.1.0.GA/usr/local/jboss5
  24.  
  25. Delete default jboss applications, such as jmx-console and admin-console. (You can keep these applications if necessary)
  26. Cd/usr/local/jboss5/server/default/deploy
  27. Mkdir/bak/laji
  28. Mv admin-console.war jbossws. sar jmx-console.war jmx-remoting.sar management messaging/bak/laji
  29. Cp-rvp ROOT. war/bak/laji
  30. Rm-rf ROOT. war /*
  31.  
  32. Modify the main configuration file of jboss as follows:
  33.  
  34. <Service Name="Jboss. web"> 
  35.  
  36. <Connector Port="8080" Address="0.0.0.0" 
  37. MaxThreads="2500" Strategy="Ms" MaxHttpHeaderSize="8192" 
  38. EmptySessionPath="True" 
  39. EnableLookups="True" RedirectPort="8443" AcceptCount="100" 
  40. ConnectionTimeout="20000" DisableUploadTimeout="True" Compression="On" 
  41. CompressableMimeType="Text/html, text/xml, text/javascript, text/css, text/plain" 
  42. UseIPVHosts="True" 
  43. /> 
  44. Start jboss:/usr/local/jboss5/bin/run. sh-c default &
  45. (You can also use the nohup method to start it, or wait for the jboss to start up in the background and enter exit to exit the terminal, and then log on to the server again)
  46. Disable jboss:/usr/local/jboss5/bin/shutdown. sh-S
  47. 3: Configure mod_jk and apache
  48.  
  49. Cd/usr/local/src/tarbag/
  50. Wget http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.31/x86_64/mod_jk-1.2.31-httpd-2.2.x.so
  51. Cp mod_jk-1.2.31-httpd-2.2.x.so/usr/local/apache2.2.16/modules/mod_jk.so
  52.  
  53. Add the following content to the apache main configuration file:
  54. Grep 'jk '/usr/local/apache2.2.16/conf/httpd. conf
  55. Include conf/extra/mod_jk.conf
  56.  
  57. The content of the newly added mod_jk.conf configuration file is as follows:
  58. Cat/usr/local/apache2.2.16/conf/extra/mod_jk.conf
  59. LoadModule jk_module modules/mod_jk.so // load mod_jk Module
  60. JkWorkersFile conf/extra/workers. properties // This file is used to control the jboss port for request forwarding.
  61. JkLogFile logs/mod_jk.log // mod_jk log
  62. JkLogLevel info // The log level is info.
  63. JkLogStampFormat "[% a % B % d % H: % M: % S % Y]" // log timestamp format
  64. JkOptions + ForwardKeySize + ForwardURICompat-ForwardDirectories
  65. JkRequestLogFormat "% w % V % T" // log request format
  66. JkMount/* cas
  67. # JkMountFile conf/extra/uriworkermap. properties
  68. JkShmFile logs/jk. shm
  69. # Add jkstatus for managing runtime data
  70.  
  71. <Location/Jkstatus/> 
  72. JkMount status
  73. Order deny, allow
  74. Deny from all
  75. Allow from 192.168.50.8
  76. Allow from 127.0.0.1
  77. Location> 
  78.  
  79. Cat/usr/local/apache2.2.16/conf/extra/workers. properties
  80. Worker. list=Cas 
  81. # Define cas
  82. Worker. cas. port=8009 
  83. Worker. cas. host=127. 0.0.1
  84. Worker. cas. type=Ajp13 
  85. Worker. cas. cachesize=10 
  86.  
  87. Worker. XXX. port corresponds to the ajp port of the jboss application,
  88. Worker. XXX. host IP Address
  89. Note that JkMount/* XXX must be added to the list items of worker. list in mod_jk.conf; otherwise, apache cannot be started.
  90.  
  91. Configure the apache VM as follows:
  92. Grep-v '^ #'/usr/local/apache2.2.16/conf/extra/httpd-vhosts.conf | grep-v '^ $'
  93. NameVirtualHost 192.168.50.7: 80
  94. <VirtualHost192.168.50.7: 80> 
  95. ServerName 192.168.50.7
  96. <Location /> 
  97. Order deny, allow
  98. Deny from all
  99. Location> 
  100. VirtualHost> 
  101. <VirtualHost192.168.50.7: 80> 
  102. ServerName jboss.766.com
  103. CustomLog "|/usr/local/apache2.2.16/bin/rotatelogs/usr/local/apache2.2.16/logs/jboss_log _ % Y % m % d 86400 480" combined
  104. Errorlog "log/jboss-error.log"
  105. RewriteEngine on
  106. JkMount/* cas
  107. VirtualHost> 
  108.  
  109. /Usr/local/apache2.2.16/bin/apachectl-k restart
  110.  
  111. Test:
  112. Tail-f/usr/local/apache2.2.16/logs/access_log
  113. 192.168.50.8--[06/May/2011: 13: 45: 28 + 0800] "GET/HTTP/1.1" 403 202
  114.  

    650) this. width = 650; "border = 0>

  115.  
  116.  

    650) this. width = 650; "border = 0>

     

    650) this. width = 650; "border = 0>

  117.  
  118. Tail-f/usr/local/jboss5/server/default/log/localhost_access_log.2011-05-06.log
  119. 192.168.50.8--[06/May/2011: 15: 17: 28 + 0800] "GET/HTTP/1.1" 200 37

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.