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

8 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
  7. Free Python Programming Free for first 100 students
    https://www.udemy.com/course/core-python-programming-by-examples/?couponCode=FREEAPR2022

    Free Apache Maven for Beginners
    https://www.udemy.com/course/apache-maven-for-beginners/?referralCode=B6DAF84DEE7F9F4201FC

    Free Git (Bitbucket) in Unix or Windows
    https://www.udemy.com/course/git-bitbucket-in-unix-or-windows/?couponCode=FREEFOR1000IN5DAY

    Free Packer (Product of HashiCorp) Images from Scratch in OCI
    https://www.udemy.com/course/packer-product-of-hashicorp-custom-images-creation-from-scratch-in-oci/?couponCode=EFFD615E33FA3D53E7AA

    Python 3.x Programming Full Course In Just 360
    https://www.udemy.com/course/core-python-programming-by-examples/?couponCode=APR2022360ONLY

    Docker + Security + AWS Basics + Jenkins
    https://www.udemy.com/course/docker-security-aws-basics-jenkins/?couponCode=APR2022360ONLY

    Jenkins (Mastering in Jenkins with other Tools)
    https://www.udemy.com/course/jenkins-mastering-in-jenkins-with-other-tools/?couponCode=APR2022360ONLY

    Packer, Terraform, Jenkins and Vagrant in AWS Cloud (5-In-1)
    https://www.udemy.com/course/packer-terraform-jenkins-and-vagrant-in-aws-cloud-5-in-1/?couponCode=APR2022360ONLY

    Packer from Scratch in AWS
    https://www.udemy.com/course/packer-from-scratch-in-aws/?couponCode=APR2022360ONLY

    Terraform for AWS by Examples
    https://www.udemy.com/course/terraform-for-aws-by-examples/?couponCode=APR2022360ONLY

    Ansible Hands On in On-Premises & AWS Cloud Environments
    https://www.udemy.com/course/ansible-hands-on-in-on-premises-or-aws-cloud-environments/?couponCode=APR2022360ONLY

    ReplyDelete
  8. Subscribe for more video: Python Full Course https://youtu.be/1szXJEfNBf8

    ReplyDelete