How to configured the Apache web server (virtual host) for using the two web server (tomcat -1 and tomcat 2)


Follow the following steps:
1. Installed the Apache httpd in Apache server.
2. Install the java or upgrade
3. Install the tomcat in web server.
4. Access the virtual host from client with domain name.

















In more details:
1. Installed the Apache httpd in Apache server.
Logging into the Apache server with root user
Note: I'm using the,Red Hat Enterprise Linux
# yum install httpd
To start/stop/restart the Apache/httpd, run:
# chkconfig httpd on
# /etc/init.d/httpd start/stop/restart

 Edit the Apache conf file, httpd.conf located under /etc/httpd/conf/httpd.conf
 #vi /etc/httpd/conf/httpd.conf

Add the below in end of file

<VirtualHost *:80>
        DocumentRoot /home/www/www.tutorialbyexample.com
        ServerName  www.tutorialbyexample.com

        ProxyPass                      /     ajp://localhost:20010/ retry=0 ttl=600
        ProxyPassReverse        /      ajp://localhost:20010/

        ProxyPass                      /*     ajp://localhost:20010/* retry=0 ttl=600
        ProxyPassReverse        /*      ajp://localhost:20010/*
</VirtualHost>

<VirtualHost *:80>
        DocumentRoot /home/www/www.apacheserverwebserver.com
        ServerName  www.apacheserverwebserver.com

        ProxyPass                      /     ajp://localhost:20020/ retry=0 ttl=600
        ProxyPassReverse        /      ajp://localhost:20020/

        ProxyPass                      /*     ajp://localhost:20020/* retry=0 ttl=600
        ProxyPassReverse        /*      ajp://localhost:20020/*

</VirtualHost>

Save it and close it.
Restart the Apache server: /etc/init.d/httpd restart
Note: # indicate i have logging with root user.

2. Install the java or upgrade
Refer the java installation.

3. Install the tomcat in web server.
Refer the tomcat install in Unix.

Assuming tomcat have installed in both web server and configure with AJP port
Web Server 1 (tomcat with AJP port 20010)
Web Server 2 (tomcat with AJP port 20020)

Just check,
/tomcate/conf/server.xml
 <Connector  protocol="AJP/1.3"  URIEncoding="UTF-8"  port="20010" />

and
<Connector  protocol="AJP/1.3"  URIEncoding="UTF-8"  port="20020" />

Restart the tomcat.


4. Access the virtual host from client with domain name. 
Access the both virtual host (vhost) from any client as mention below.

www.tutorialbyexample.com
www.apacheserverwebserver.com

Note: All about in your network accessible area, don't expect this conf for outside of world (over internet).

Reference: vhost

6 comments:

  1. http://www.tutorialbyexample.com/2015/11/apache-virtual-host-webserver-ajp.html, change the
    ajp://localhost:20010/ to ajp://IP-Address-Web-Server-1:20010/
    ajp://localhost:20020/ to ajp://IP-Address-Web-Server-2:20020/

    Response if any issue while doing this...

    ReplyDelete
  2. There are no companies authorized by the consumers without a proper website nowadays. Web design

    ReplyDelete
  3. The writings are so mesmerizing, you can’t spend a minute without them.Web design in Lincoln NE

    ReplyDelete
  4. Such a great blog and all the writings. Can’t help thinking about the author.
    landing page

    ReplyDelete
  5. Thanks and it's for me Apache Virtual Host Web-server configuration.

    ReplyDelete
  6. Interesting and interesting information can be found on this topic here profile worth to see it.
    mason soiza

    ReplyDelete

Please provide your input, it will honer for me...