location - How to access three Web products via Apache Web server using single IP and one port -


we appreciate vectors solve following issue accessing our web products via urls. access 3 products through port 80 on our hosted server has 1 public ip. accessed @ different points of time using single port of them. how access these products via following urls? can achieved through apache web server configuration below? or, need local dns server in addition apache web server configuration?

products accessed via urls:

http://<our.server.fully.qualified.domain.name.com>/product1 http://<our.server.fully.qualified.domain.name.com>/product2 http://<our.server.fully.qualified.domain.name.com>/product3 

in /etc/hosts file, have added

10.10.10.100 product1 product2 product3 

apache web server’s vhosts.conf

<virtualhost 10.10.10.100:80>     documentroot "/usr/local/product1"     servername product1     serveradmin admin@our.server.fully.qualified.domain.name.com     errorlog "/usr/local/apache2/logs/error_log"     transferlog "/usr/local/apache2/ logs/access_log" </virtualhost>  <virtualhost *:80>     documentroot "/usr/local/product2"     servername product2     serveradmin admin@our.server.fully.qualified.domain.name.com     errorlog "/usr/local/apache2/logs/error_log"     transferlog "/usr/local/apache2/ logs/access_log" </virtualhost>  <virtualhost *:80>     documentroot "/usr/local/product3"     servername product3     serveradmin admin@our.server.fully.qualified.domain.name.com     errorlog "/usr/local/apache2/logs/error_log"     transferlog "/usr/local/apache2/ logs/access_log" </virtualhost> 

edit: @arober11’s solution worked us, have extended configuration 3 additional products distributed across 2 servers (virtual machines, vm-1, vm-2) on same physical server:

(1) product4 in different directory (/usr/local/dir4/product4) of vm-1 (products1/2/3 in /usr/local).

(2) product5 in different server vm-2 in /usr/local/dir5/product5.

(3) product6 in vm-2 in /usr/local/dir6/product6.

we understand virtualhost container can have 1 servername, which, in turn, can have 1 documentroot. therefore, each of products 4/5/6, have to:

(i) create new virtualhosts respective ip , port numbers?

(ii) add servernames /etc/hosts of vm-1 , vm-2 respectively. (or, redundant in expanded deployment?)

---------details-----------

both vms accessed same external ip. private ips of virtual machines , dns pointers are:

vm-1:  http://<our.server.fully.qualified.domain.name.com> -> 10.10.10.100 (port 80) vm-2:  http://<our.server.fully.qualified.domain.name.com:9080> -> 10.10.10.200 (port 9080) 

the products accessed via:

http://<our.server.fully.qualified.domain.name.com>/product4  (in vm-1) http://<our.server.fully.qualified.domain.name.com>:9080/product5 (in vm-2) http://<our.server.fully.qualified.domain.name.com>:9080/product6 (in vm-2) 

(1) product 4 in vm-1.

<virtualhost *:80> documentroot "/usr/local/dir4/product4" servername product4 serveradmin admin@our.server.fully.qualified.domain.name.com errorlog "/usr/local/apache2/logs/error_log" transferlog "/usr/local/apache2/ logs/access_log" <directory />  directoryindex index.php </directory> </virtualhost> 

(2) product 5 (which in vm-2)

<virtualhost 10.10.10.200:9080> documentroot "/usr/local/dir5/product5" servername product5 serveradmin admin@our.server.fully.qualified.domain.name.com errorlog "/usr/local/apache2/logs/error_log" transferlog "/usr/local/apache2/ logs/access_log" <directory /> directoryindex index.html </directory> </virtualhost> 

(3) product 6 (which in vm-2)

<virtualhost 10.10.10.200:9080> documentroot "/usr/local/dir6/product6" servername product6 serveradmin admin@our.server.fully.qualified.domain.name.com errorlog "/usr/local/apache2/logs/error_log" transferlog "/usr/local/apache2/ logs/access_log" <directory /> directoryindex abc.jsp </directory> </virtualhost> 

you can lose redundant /etc/hosts entry, need single virtualhost, docroot pointed @ parent directory of sub-directories eg.

<virtualhost *:80>   documentroot "/usr/local/"   servername our.server.fully.qualified.domain.name.com   serveradmin admin@our.server.fully.qualified.domain.name.com   errorlog "/usr/local/apache2/logs/error_log"   transferlog "/usr/local/apache2/logs/access_log" </virtualhost> 

Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

qt - Passing a QObject to an Script function with QJSEngine? -

c# - Web API response xml language -