Multiple sites using Apache Virtualhost directive

A useful and easy way to setup multiple web sites using the Apache HTTP Server is the practice of the virtual host: that is the ability to host multiple web sites on the same instance of httpd service. The community offers an impressive number of modules and libraries that allow you to extend the of Apache core functionality. In this article I will show how to use the proxy_ajp_module extension to configure multiple web sites dns on the same server using the “VirtualHost” Apache directive. The following figure shows the scenario that I will examine.
screen07
Apache Web Server – IP: 10.10.1.50
Install, if not present, the http Apache Web Server and check proxy_ajp module.
Setup the multiple sites proxy pass/reverse definition by creating a configuration file like this.
I used the RedirectMatch definition to default redirect  the base ServerName url to ProxyPass definition. In this way, Apache make a default redirect url from http://site1.mydomain.com  to  http://site1.mydomain.com/my_app1. Now proceed with the two Tomcat Server configurations.
Tomcat Application Server -IP:10.10.1.100
Tomcat Application Server -IP:10.10.1.200
If you have performed a default installation of the Tomcat applicaton server, the ajp connector is already configured. Check the server.xml file. You should make sure that line of ajp definiton is uncommented.
If you want to make some tests make sure to set the dns entries to the /etc/hosts file on the client and server machines. You clould set someting like this:

Nhận xét

Bài đăng phổ biến