In this example a sample web application is deployed on Apache Tomcat 6 server. Apache HTTPD server is used as a reverse proxy server.
Launch JBoss Enterprise Web Server
-
In the 'Navigation' pane, click on "Launch Instance";
-
Find and select a Jboss Enterprise Web Server AMI according to Configure and launch AMI;
-
Click in the "User Data:" field and enter the following lines:
# deploy the hello.war sample application to the Apache Tomcat 6 server which is part of the JBoss Enterprise Web Server offering
cp /usr/share/java/jboss-ec2-ews-samples/hello-1.0.war /usr/share/tomcat6/webapps/hello.war
# Configure HTTPd to act as a proxy to the Apache Tomcat 6 server
cat >> /etc/httpd/conf.d/proxy_ajp.conf <<"EOF"
<Location /hello>
ProxyPass http://localhost:8080/hello
ProxyPassReverse http://localhost:8080/hello
</Location>
ProxyPreserveHost On
EOF
# Start the Apache Tomcat 6 server
service tomcat6 start
# Instruct SELinux to allow HTTPd to serve as a proxy relay
setsebool -P httpd_can_network_relay 1
# Start the HTTPd server
service httpd start
-
continue with the instructions from Configure and launch AMI;
-
Wait until the instance's status is shown as "running";
Test JBoss Enterprise Web Server
-
In the instance's details pane, note the instance's "Public DNS";
-
In a browser, navigate to http://<public-DNS>/hello
-
Confirm that the text "Hello World!" appears, otherwise refer to the Troubleshooting section.
For JBoss Enterprise Web Server, the contents of the User Data field are treated as a script. If the first line is "#!" then it is run as any executable file, otherwise its contents are executed/sourced into the Red Hat Enterprise Linux init shell.
If this is to be a production instance, add the following text to the contents of the User Data field, to ensure that security updates are applied on boot: