• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setting up 2 application using virtual host in apache

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

I need to run 2 application in one webserver (apache), currently i am running one without any issues when i try to configure vhost (virtual host) to run my 2nd application it always defaults to first one or (what is mentioned under document root in httpd conf file) it does not pick from vhost conf file which has document root set for both application differently. Can some one send me sample of httpd & vhost config which as similar setup I need to use Ip based virtual host setting. I dont want to change my host file setup i need to set this up in my production system and i already registered the name in DNS for the host i am configuring.

Thanks,
Vijay
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vijay and welcome to Javaranch! Can you post the conf files you've tried so far?

 
Nvvijay Rag
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

below is my setup in both http & vhost conf file


Httpd.conf - setup

ServerRoot "C:\Apache2.2.17"

Listen 80

ProxyPreserveHost On

DocumentRoot "C:/Apache2.2.17/htdocs"

# Virtual hosts
Include conf/extra/httpd-vhosts.conf


My httpd-vhosts.conf -Setup

<VirtualHost 50.35.20.60>
DocumentRoot "C:/Apache2.2.17/htdocs"
ServerName www.website1.com
</VirtualHost>

<VirtualHost 50.35.20.65>
DocumentRoot "C:/Apache2.2.17/website2"
ServerName www.website2.com
</VirtualHost>


as per above configuration when I type www.website1.com , the home page(index.html) from htdocs should be served.
when I type www.website2.com home page (index.html) from website2 folder present under C:/Apache2.2.17/website2 should be displayed.
But index.html of website1 is always displayed even when I type www.website2.com

If I change the document root setup in httpd.conf to DocumentRoot "C:/Apache2.2.17/website2", when I type www,website1.com
I am getting website2.com hompe page

What is wrong in above configuration. My DNS configuration is done corerctly when i type www.website2.com
i can see IP as 50.35.20.65 in browser status bar, for website1.com i see 50.35.20.60.

Thanks


 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not familiar with Apache Httpd set-up, but one thing I'd change is to make sure your '/' and '\' are consistent. Since you are not using spaces in your directory paths you should be able to use '\' safely. To also identify the root cause of the problem a little easier, I'd recommend having website one as separate from the default, e.g. Have:


Httpd.conf - setup



My httpd-vhosts.conf -Setup



This might help identify a problem where the DocumentRoot isn't being overridden as you'd expect.
 
reply
    Bookmark Topic Watch Topic
  • New Topic