JBoss 7 application deployment without Apache
Posted by on 09 January 2012 10:44 AM
|
|
Applicable Plans - All Cloud Hosting PlansJBoss 7 Application Deployment without Apache Web ServerOverviewUsing the eApps Virtual Server in the Cloud Hosting service, Java SE 6 or Java SE 7, and JBoss 7, you can create web sites and web applications with dynamic content for your customers and users. This User Guide is designed to help you deploy your JBoss applications in Standalone mode, without Apache. Reading the Installation and Tuning User Guide is a prerequisite for this User Guide, because the things covered in that User Guide are generally not covered again here, such as how to stop, start, or restart JBoss, how to set JBoss to start after system boot, and how to access the JBoss 7 Administration Console. Pay careful attention to the resources allocated to your Virtual Server when deploying JBoss 7 applications, especially the available RAM. JBoss can be very memory intensive, and a lack of resources is one of the main reasons for poor performance. For a small JBoss application, start with at least 1024 MB of RAM, and be prepared to scale upwards as necessary. For larger JBoss applications, start with at least 1536 MB of RAM, and again be ready to scale upwards if your traffic and resource needs demand it. If you do not need the advanced features of JBoss, and just need support for JSP and Servlets, we recommend that you uninstall JBoss and install Tomcat instead, as Tomcat uses less resources and is not as complex as JBoss to configure and use. JBoss is a very complex and powerful application that is intended for advanced users who are deploying enterprise grade applications. Before deploying your applications with JBoss, make sure that you really need all the complexity that JBoss provides. To make the best use of JBoss you need to be an expert in Java application programming and deployment. JBoss Application Deployment without Apache Setting up JBoss to run without Apache Deployment Examples using JBoss 7 without Apache Deploying your application using the JBoss 7 Administration Console Installing JBoss 7Information and instructions on installing JBoss 7 and related applications can be found in the JBoss 7 Installation and Tuning Guide. Make sure you have read that guide before starting to deploy your applications. JBoss Application Deployment without ApacheJBoss includes its own web server, so Apache is not technically needed. It is possible to run JBoss without Apache. This approach is best suited when the Virtual Server is only going to be used to run this application, and nothing else. This is because any of the applications that rely on Apache and PHP, such as any of the webmail applications, AWStats, phpMyAdmin, etc, will not be available. This approach is for users who are very familiar with JBoss and Linux server configuration. Most users will see no benefit by using this approach. Setting up JBoss to run without ApacheJBoss cannot run on port 80 because root privileges are required. Since JBoss does not have the ability to start as root, bind to port 80, then switch back to a user without administrative privileges it would have to run as root. This creates a security issue for your system. To use JBoss in Standalone mode, you will need to add a file to the /etc/xinted.d directory that will keep JBoss running on port 8080, and have any requests to port 80 redirected to JBoss. You will also need to change the port that the Apache web server listens on, so that you can continue to keep the Apache server running. All of this must be done from the command line of the Virtual Server, as the root user. See the User Guide: SSH - http://support.eapps.com/ispmgr/ssh for more information if needed. Changing the Apache portChange directories to /etc/httpd/conf, and make a backup of the existing httpd.conf file. Then open the httpd.conf file with a text editor (vim and nano are available). [root@eapps-example ~]# cd /etc/httpd/conf Find the By default, this is set to port 80. #Listen 12.34.56.78:80 Change this to port 81, and save and exit the file. #Listen 12.34.56.78:80 Once you have done this, restart Apache with the [root@eapps-example conf]# service httpd restart Add the port 80 redirectOnce you have set up Apache to listen on a different port, change directories to /etc/xinetd.d, and create the jboss file: [root@eapps-example ~]# cd /etc/xinetd.d Using a text editor (this example uses the vim editor), add these lines to the jboss file: # Redirects any requests on port 80 Save and exit the file, and then restart the xinetd service with the [root@eapps-example xinetd.d]# service xinetd restart Now the Apache web server is listening on port 81, and all requests for port 80 will be redirected to port 8080. Deployment Examples using JBoss 7 without ApacheUsing the JBoss 7 Administration Console, you can deploy your application WAR file and set up your Virtual Host. However, for this to work, you will have to have a jboss-web.xml file in the WEB-INF directory in your WAR file with the correct These examples use a domain of eapps-example.com, and an application named mywebapp. You will need to substitute your own domain and application names where appropriate. There are two deployment approaches when using standalone mode:
In both cases, the way to deploy (upload) the file and set up the Virtual Host in the JBoss Administration Console is the same. See the section of this User Guide titled Deploying your application using the JBoss 7 Administration Console for more information. What differs is the configuration of the jboss-web.xml file. Deployment with JBoss 7 serving JSP and Servlets using a WAR file at eapps-example.com/mywebappThis deployment example assumes you have a WAR file called mywebapp.war, using a Virtual Host of eapps-example.com. For this deployment approach to work, you will need to add the following in your WEB-INF/jboss-web.xml file: <jboss-web> Deployment with JBoss 7 serving JSP and Servlets using a WAR file at eapps-example.comThis deployment example assumes you have a WAR file called mywebapp.war, using a Virtual Host of eapps-example.com. For this deployment approach to work, you will need to add the following in your WEB-INF/jboss-web.xml file: <jboss-web> Deploying your application using the JBoss 7 Administration ConsoleOnce you have the jboss-web.xml file set up, you can package your WAR file and then deploy the application. To do this, log in to the JBoss 7 Administration Console. See the User Guide: JBoss 7 Install and Tuning - JBoss 7 Administration Console - http://support.eapps.com/ispmgr/jboss7-install#jboss-7-administration-console for more information on how to access the Administration Console. Once you are logged in to the Administration Console, go to Deployments > Manage Deployments. ![]()
![]()
![]() Once you have selected the WAR file, click Next.
![]() Click on Save.
Do not enable the application at this point. ![]()
![]() To add the Virtual Server, click on Add.
![]()
Once you have entered the information, click on Save.
![]()
Now you need to enable your application so that it is available. Click on Runtime at the top right of the screen, and then go to Deployments* >Manage Deployments*. Then click on Enable. ![]()
![]() Click Confirm to enable the application. The NO symbol under the Enabled column will now be a check mark. ![]()
| |
|