0

I have made a private cloud using ubuntu 12.04 LTS. I have a maas main server. On that server, I want to host my web application written with java, tomcat and mysql. My maas main server ip address is 192.168.43.191 and dns name is ubuntucloud. So, when I call it from browser like (http: ubuntucloud), I can reach and see "It's work. This is the default web page for this server. The web server software is running but no content has been added yet" sentences. I can call my web application like (http: ubuntucloud:8080/IRMultiAgent/) while running tomcat server in eclipse. I want to call my web app like (http://www.ir_multi_agent/). How to do this? ps: I omit some "/" in my post, because of error

0

You can configure your Apache web server to forward requests to Tomcat using mod_jk (The Apache Tomcat Connector). Setup an Apache vhost which acts as some kind of proxy to speak to Tomcat and is also able to rewrite the URL. Thus, ubuntucloud:8080/IRMultiAgent/ can be accessed at e.g. irmultiagent.ubuntucloud/ (Smart HowTo)

Since you already configured the domain ubuntucloud to point to your server, you should be able to also setup such a DNS for ir_multi_agent. Both can point to the same IP. Just make sure to configure the ServerName of the vhosts directives in the Apache configuration correctly.

|improve this answer|||||
  • I followed your Smart HowTo link. I have little difficulty in creating virtual host. ServerAdmin some@body.tld ServerName yourapp.yourserver.tld ServerAlias ya.yourserver.tld .. Can I add ServerAdmin,ServerName and ServerAlias as I wish? – yu mon Oct 6 '13 at 14:12
  • Yes of course. Those are just dummies. Find all available core features and their meaning at httpd.apache.org/docs/2.2/mod/core.html – binfalse Oct 7 '13 at 9:07
0

The simplest way to do this is to add the name ir_multi_agent to your /etc/hosts file. In order to do that, edit that file using sudo vi /etc/hosts or sudo nano /etc/hosts and add the line

192.168.43.191    ir_multi_agent

From then on, you will be able to browse to http://ir_multi_agent:8080/IRMultiAgent and access your application.

To get rid of the :8080 in that URL, you have two options:

  1. Run Tomcat on the default http port (80) by editing the port number in its conf/server.xml file. Note that this requires you to run Tomcat as root.
  2. Front the Tomcat server with a reverse proxy, which will require installing and configuring an http server such as apache2 or nginx.

Now, your URL is down to http://ir_multi_agent/IRMultiAgent. To get rid of the IRMultiAgent context root, you again have two options:

  1. Deploy the application as the ROOT web application on Tomcat. That is, put it in the folder webapps/ROOT.
  2. Use rewrite rules on the reverse proxy.

There you have it, your own webapplication at http://ir_multi_agent/.

Before embarking on all this, please consider Shakespeare's wisdom. An URL is but a name.

|improve this answer|||||
  • thz for your help @zwets. I want to know again is how to run tomcat as root. Recently, I log into with my account "yumon" and tomcat6.04 and eclipse are all installed when i am with yumon account. – yu mon Oct 4 '13 at 8:34
  • When I run Tomcat on the default http port (80) by editing the port number in its conf/server.xml, I've got permission denied 80: java.net.Bindexception Error occurs. It is because I'm not root yet? – yu mon Oct 4 '13 at 8:45
  • Processes other than root are not permitted to open ports up to 1024 for listening. You must sudo start Tomcat to run it with root priviliges. – zwets Oct 4 '13 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.