logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: vhosts doesnot work, how can I see what hostinfo apache gets
Author
joelbox



Joined: 24 Mar 2008
Posts: 6
Location: Groningen

PostPosted: Mon 24 Mar '08 13:29    Post subject: vhosts doesnot work, how can I see what hostinfo apache gets Reply with quote

Hi greetings from Groningen,

I have been trying to get the virtualhost to work correctly but, nothing seems to help.

This is the case:
I have several domains registered at eurodns. www.mysite.dk, www.mysite.eu, www.mysite.nl. These domains are redirected to the IP of my server. The Apache 2.2 server is up and running (on a vista machine) and serving pages. My server is behind a router. I want each domain to show a different site.

I have setup virtual hosts as:

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/drupal-5.7"
ServerName www.mysite.dk
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/wamp/www/eu"
ServerName www.mysite.eu
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/wamp/www/dutch"
ServerName www.mysite.nl
</VirtualHost>


But no matter what url I type in explorer I always get to the C:/wamp/www/drupal-5.7 site.

I studied the logs, and i get the idea that the servername is not send by eurodns. Is that possible? How can I check what url comes in and what apache should do with it?

I would appreciate any help, this issue is now bogging me for days.
Joel
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3092
Location: Hilversum, NL, EU

PostPosted: Mon 24 Mar '08 13:58    Post subject: Reply with quote

Try:


NameVirtualHost *

<VirtualHost *>
ServerName just_a_name
DocumentRoot "C:/wamp/www/unknown"
</VirtualHost>

<VirtualHost *>
ServerName www.mysite.dk
ServerAlias mysite.dk
DocumentRoot "C:/wamp/www/drupal-5.7"
</VirtualHost>

etc. etc.

note:
The first VirtualHost section is used for all requests that do not match a ServerName or ServerAlias in any <VirtualHost> block. You can put an error page in the doc root there.


Steffen
Back to top
joelbox



Joined: 24 Mar 2008
Posts: 6
Location: Groningen

PostPosted: Mon 24 Mar '08 14:14    Post subject: Reply with quote

Hi Steffen great approach,

Gave it a few tries. This is what happens.

I inserted localhost as a virtualhost aswell. Going to url localhost indeed lands me on the directory as set.

But my external url www.mysite.dk now ends up with the page not found error.

from this i learn that the virtual host conf is working and use by apache. But somehow the "www.mysite.dk" does not come through. How to check this?
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3092
Location: Hilversum, NL, EU

PostPosted: Mon 24 Mar '08 17:32    Post subject: Re: vhosts doesnot work, how can I see what hostinfo apache Reply with quote

joelbox wrote:
These domains are redirected to the IP of my server. The Apache 2.2 server is up and running (on a vista machine) and

What do you mean with Redirected ?

Steffen
Back to top
joelbox



Joined: 24 Mar 2008
Posts: 6
Location: Groningen

PostPosted: Mon 24 Mar '08 18:57    Post subject: Reply with quote

Hi Steffen,
At the domain registrar you have two options of pointing the domain name to an IP.

    One is using a frame, the new IP is inset into a frame.
    the other is using a redirect. The DNS is set up to point to my IP directly.


I tested it with both options, with the same (no) result.

Can it have something to do with the case that i am connecting from my home network onto the webserver which is in this network? (That then no hostname www.mysite.dk is passed to apache to reckognise as virtual host)?

kind regards,
Joel
Back to top
joelbox



Joined: 24 Mar 2008
Posts: 6
Location: Groningen

PostPosted: Sat 29 Mar '08 10:42    Post subject: The solution for when IP shown instead of domain name. Reply with quote

At the registration organisation, I should have made settings as:

A-record <www.domainname.com> <IP address>


Using the a-records in stead of the redirect solved all issues.
thanks for all the help,
Joel
Back to top


Reply to topic   Topic: vhosts doesnot work, how can I see what hostinfo apache gets View previous topic :: View next topic
Post new topic   Forum Index -> Apache