2

I want to have two webapps (webapp1 and webapp2 resident under /var/www/html/webapps/), both using PHP and JSP, running on the same machine:

  • Apache 2.4
  • Tomcat 7.0.50 (+APJ connector)

and want to make them accessible through the following URLs (with identical IP and ports):

localhost/webapp1
localhost/webapp2

I am aware of Virtual Hosts facility. The problem is that Apache seems to "see" only the first site available: whenever I look for localhost/webapp2, I get a 'Not Found' error. Note that if I look for "localhost:8080/webapp2" (i.e., bypassing apache2) everything works fine.

Each webapp has its own conf file under sites-available directory. For example, in webapp2.conf I have

JkMountCopy On
JkMount /webapp2/* tomcat_worker

How can I solve?

SpringLearner
  • 13,738
  • 20
  • 78
  • 116

1 Answers1

0

From the documentation

Note

Creating virtual host configurations on your Apache server does not magically cause DNS entries to be created for those host names. You must have the names in DNS, resolving to your IP address, or nobody else will be able to see your web site. You can put entries in your hosts file for local testing, but that will work only from the machine with those hosts entries.

Listen 80
Listen 8080

<VirtualHost 172.20.30.40:80>
ServerName www.example.com
DocumentRoot "/www/domain-80"
</VirtualHost>

<VirtualHost 172.20.30.40:8080>
ServerName www.example.com
DocumentRoot "/www/domain-8080"
</VirtualHost>
<VirtualHost 172.20.30.40:80>
ServerName www.example.org
DocumentRoot "/www/otherdomain-80"
</VirtualHost>
<VirtualHost 172.20.30.40:8080>
ServerName www.example.org
DocumentRoot "/www/otherdomain-8080"
</VirtualHost>

If you want additional help, show us your configuration files related.

Bonatti
  • 2,778
  • 5
  • 23
  • 42