0

Trying to set up a .war file (using tomcat 7) on a VPS and all is working fine if I use:

http://111.111.111.111:8080/MyProject/blog.jsp

But if I go to the one below I get stuck on the UserServlet I've made:

http://111.111.111.111.com/blog.jsp

I had a feeling this was a context.xml or server.xml problem that just needed to be changed but I can't spot anything there that could be causing this.

Edit - So I think I need to change the server.xml file. But my VPS won't give me the permission to edit this file. Anyone know how to get around this?

3 Answers3

0

This topic is about Domain Name, you need a DNS (Domain Name Server) to configure a Domain Name. The simplest is to use host file:

  1. Windows: C:\Windows\System32\drivers\etc\hosts
  2. Linux: /etc/hosts

You have to add to host file something like this:

111.111.111.111 domain_name

So, you can access to web site as follows:

http://domain_name:8080/MyProject/blog.jsp

In this case, you can't avoid to put the port number. This is the simplest, if you want better something, I think you need a DNS.

I hope this information helps you.

Good luck.

hmrojas.p
  • 562
  • 1
  • 5
  • 15
  • That's working alright, but I dont want the port or the name of project there if that makes sense. – user3504452 May 26 '14 at 23:55
  • Then you can use `Name_URL`, you have to put this tag in your web.xml, but if you want to avoid put the port, you need a DNS or some configuration more advanced on your server. – hmrojas.p May 27 '14 at 00:03
0

You need to use port-forwarding for this to work.

Lets say you hit the URL address of your domain www.xyz.com. Then you need to create a rule on your external router that hosts this domain to forward the port 80 request to port 8080.

Port forwarding can be even deployed on a firewall is any exists...

Community
  • 1
  • 1
MaVRoSCy
  • 17,747
  • 15
  • 82
  • 125
0

You need to setup a webserver in front and a protocol like jk or proxy. The easiest way is Apache WebServer and mod_jk. In the webserver, mapped to port 80, you define a virtual host to listen to your domain name. In that conofig section you need to define a mapping to the Tomcat server. Have a look at:

What is the best way to install Mod_jk on linux to run apache in front of tomcat

Multiple Subdomains in Apache / Tomcat with mod_jk

Tomcat load balancer solutions

Community
  • 1
  • 1
Stefan
  • 12,108
  • 5
  • 47
  • 66