Question

Deployed a java web application. Not able to access the application via the IP address.

  • Posted on November 16, 2014
  • kavishaAsked by kavisha

I created a Ubuntu 14.04 droplet, and installed tomcat. My droplet’s ip address(from the mail i recieved) is say for example : IP_address.

After that i installed a web application using this tutorial :https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-7-on-ubuntu-14-04-via-apt-get.

I am able to access my application using http://IP_address:8080/myapplication.

Also, I have have connected the IP_address to my domain name using this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean.

i.e i have mydomainname.com pointing to IP_address.

Ping from my local system to the domain name gives me a reply mentioning the IP_address.

But when i try to access http://IP_address, my browser just says “This webpage is not available”.

Any help on this would be useful. Thanks in advance.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Browsing to http://IP_address doesn’t work because there is nothing listening on port 80 (tomcat is listening on 8080). I would recommend installing nginx and configuring it a reverse proxy so that it forwards requests from port 80 to port 8080.

Run the following command:

sudo apt-get install nginx

Then, edit /etc/nginx/sites-enabled/default and replace its contents with the following:

upstream tomcat {
    server http://localhost:8080;
}

server {
    listen 80;
    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://tomcat;
    }
}

Finally, restart nginx:

sudo service nginx restart