0

I use tomcat 7.0.42 on Ubuntu Linux 12.10. I point my browser to http://localhost:8080/myapp Can I create a virtual host in ubuntu which would allow me to hit the same address as

http://myapp.com

Basically creating an alias for localhost:8080/myapp as myapp.com?

aBhijit
  • 5,261
  • 10
  • 36
  • 56

2 Answers2

0

open file

/etc/hosts

and add those lines:

127.0.0.1 myapp.com

127.0.0.1 www.myapp.com

this will tell the operation system not to look for myapp.com IP address but to use localhost instead.

Ohad Cohen
  • 5,756
  • 3
  • 39
  • 36
  • I added this to hosts and restarted the system 127.0.0.1 localhost 127.0.1.1 aB-PC 127.0.1.1:8080 local.com 127.0.1.1:8081 ucma.com Doesn't work. – aBhijit Oct 03 '13 at 12:53
  • I used port numbers in host file. That was the reason it did not work. Thanks for the answer. It helped, but the original issue remains. – aBhijit Oct 03 '13 at 13:41
  • you can open a server on port 80 that will return an html page that include the tomcat in iframe – Ohad Cohen Oct 03 '13 at 14:22
0

Another solution:

open a new file, with .pac extention, those files are used by firefox to determine proxies, copy this to the content of the file:

function FindProxyForURL(url, host) {
    if (host=='www.myapp.com'){
        return 'PROXY 127.0.0.1:8080';
    }
    // All other domains should connect directly without a proxy
    return "DIRECT";
}

go to FF proxy settings under "url for automatic proxy configuration" and enter the path to that file.

Ohad Cohen
  • 5,756
  • 3
  • 39
  • 36