Mark Buikema
Mark Buikema

Reputation: 2540

How to get WAR file deployed online?

This might sound like a stupid question, but I have searched about it and couldn't find a clear answer, so I'm asking it here.

How do I get the WAR file online so I can access it from anywhere? I have a REST server in a war and I want to use it in an Android app so I need access to it from anywhere. Do I need a VPS? Can I host a VPS myself? I have searched about it but for some reason I can't find a clear instruction on how to do this.

Upvotes: 0

Views: 3112

Answers (1)

pylua
pylua

Reputation: 635

Okay, here is what you need to do.

First of all, you will have to download and run a web server on your computer. I use tomcat6 or tomcat7. On Linux, "sudo apt-get install tomcat7". Then, "service tomcat7 start" in order to start the server, and "service tomcat7 stop" the server.

On your router (that faces the internet), you will have to port forward (not safe!) all the traffic from 8080 or 80 (whatever port your rest server is at), to go to the computer that is hosting the rest server. For a typical Linksys router, that means you have to log on to 192.168.1.1, and adjust the port settings. So, get the local IP address of your computer (usually IPV4), and forward all the traffic on port 8080 (on the external facing router) to go to this local IP address.

Now, copy the war to the webserver (for tomcat7, /var/lib/tomcat7/webapps.) Before you copy the war to this directory, be sure to COMPLETELY remove any old .war applications or folders with the same name.

Then, restart the server. You should be able to access the server using the external IP address of your router as the IP address. The external IP address will be listed on your router's homepage. Your external IP address will change over time-- if you want a static IP address, it would probably be best to find a commercial host or to purchase a static IP address from your ISP.

Upvotes: 1

Related Questions