Xampp Vhosts

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Xampp Vhosts

Postby johnyp » 11. July 2010 12:04

Hello to all. I set-up a server with two virtual websites a localhost and another one.
Locally all works fine but users can go to localhost by typing the ip address of the server but not to the other site.

Here is my vhosts file:
Code: Select all
NameVirtualHost *:80


<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "D:\srvroot"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@beautyflair.gr
    DocumentRoot "D:\srvroot\beautyflair.gr"
    ServerName beautyflair.gr
    ErrorLog "logs\beautyflair.log"
    CustomLog "logs\beautyflair-access.log" combined
</VirtualHost>


In windows hosts file i added the line 127.0.0.1 beautyflair.gr

My final move were to put as dns server in domain name the ip address of my router which have as dmz host my server.

What am i doing wrong?

Thank you.
johnyp
 
Posts: 6
Joined: 11. July 2010 11:57

Re: Xampp Vhosts

Postby JonB » 11. July 2010 14:00

You have nested the beautyflair.gr DocumentRoot inside the default Vhost.
i.e - everything under D:\srvroot is part of the localhost definition (so they land on the root of localhost)

make it like this

D:\srvroot <== only contains folders
D:\srvroot\localhost
D:\srvroot\beautyflair.gr
D:\srvroot\YourNextVhost
....

good luck
:mrgreen:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Xampp Vhosts

Postby Nobbie » 11. July 2010 14:49

johnyp wrote:What am i doing wrong?


You did not define a virtual host for the ip address (only for a Domain pointing to the address, but not for ip itself). Therefore the server is an unknown virtualhost, if someone enters the ip address, and in that case always the first virtual host of your configuration is used.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: Xampp Vhosts

Postby johnyp » 11. July 2010 17:28

Look my problem has to do with my domainname. I can not define an ip address as dns and with the no-ip hostname does not work.
In another computer at my office if in windows hosts file put the line 'servers-ip beautyflair.gr' all works fine so i am doing something wrong in setting servers ip as dns for my domain name.

I did setup the vhosts in apache fine. From my local machine in address localhost i get files from root and in address beautyflair.gr i get the files from root/beautyflair.gr dolder.
So i must have configured it fine...

What do you say?
johnyp
 
Posts: 6
Joined: 11. July 2010 11:57

Re: Xampp Vhosts

Postby JonB » 11. July 2010 23:01

I say you already know all the answers.

:mrgreen:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Xampp Vhosts

Postby johnyp » 11. July 2010 23:45

What do you mean by 'already know all the answers'. I am stuck and i am asking for your help. Nobody knows everything. I can not understand what am i doing wrong here... Is it the fact that i can not put an ip address as DNS server in my domain name? Or what? Please help me. Thank you.
johnyp
 
Posts: 6
Joined: 11. July 2010 11:57

Re: Xampp Vhosts

Postby JonB » 12. July 2010 00:02

Well, I just ran a quick test and confirmed my suspicion about nested Vhosts - BAD idea.

I added a folder 'new_site' to an existing vhost. I then added an index.html to that folder with its cute unique message.

whipped into /xampp/apache/conf/extra/httpd-vhosts.conf and added a new vhost pointing to 'new_site' and named it newsite.mydomain.com. Then saved my efforts, restarted Apache, and modified the hosts file on another machine.

Wonderful --

Now if you go to http://www.mydomain.com/new_site (the folder name) - you get the same page served as you will if you go to http://newsite.mydomain.com.

So - yes it works, BUT you have effectively mixed the two sites together - more like a subdomain situation -- but with no security. (which was my point - it isn't set up right)

As for DNS,
A - I don't know how you have your setup with your registrar, but it does take time for DNS/nameserver changes to propogate, unless you use a specialized service.

B - I see now you did not name the host for beautyflair.gr (that means it is assumed to be http://beautyflair.gr in the vhost directives. There can only be ONE http:// server on a given webservice and it is the default one. That is why you are getting the default vhost.

ServerName beautyflair.gr


C - what is the hostname in the A record of your domain? If you are on a shared server you cannot use http:// by itself if you don't control the server (see above)
use this command;

nslookup beautyflair.gr and see what you get

then try it with the http://www.beautyflair.gr

OK?
8)

:D
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Xampp Vhosts

Postby JonB » 12. July 2010 00:15

what do you mean by this and why is this the case?

Is it the fact that i can not put an ip address as DNS server in my domain name?


If you have a registered domain name, you have to nominate 'nameservers' in your registrar's account maintenance. Normally that is part of the service provided, and you then have to use their interface to enter your hostnames. (A and M records)

That is a domain registrar issue, and they should be able to help you with it.

this is the clearest explanation of a complicated topic I could find:
http://www.tributemedia.com/education/t ... ystems_dns

(I'm saving it for the next DNS question I handle)

:roll:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Xampp Vhosts

Postby johnyp » 12. July 2010 12:50

Probably i can not explain my problem due to my not so good english.
Here is my situation:

A > I set up an apache installtion to a windows xp pro machine.

B > I set up in httpd-vhosts.conf two virtual host :
Code: Select all
NameVirtualHost *:80


<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "D:\srvroot"
    ServerName localhost
    ErrorLog "logs\localhost.log"
    CustomLog "logs\localhost-access.log" combined
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@beautyflair.gr
    DocumentRoot "D:\srvroot\beautyflair.gr"
    ServerName beautyflair.gr
    ErrorLog "logs\beautyflair.log"
    CustomLog "logs\beautyflair-access.log" combined
</VirtualHost>


C> I set up windows hosts file :
Code: Select all
127.0.0.1     localhost
127.0.0.1     beautyflair.gr


D> In root directory which is d:\srvroot i made a subfolder named beautyflair.gr

Now if i open the iexplorer and hit localhost i get the index.html from d:\srvroot , if i hit beautyflair.gr i get the index.html from the folder d:\srvroot\beautyflair.gr.

My problem is what changes to make in my domain name to point to my server? I can not edit nameservers to my servers ip.

I hope i explained thinks better now.

Thank you.
johnyp
 
Posts: 6
Joined: 11. July 2010 11:57

Re: Xampp Vhosts

Postby JonB » 12. July 2010 15:01

I can not edit nameservers to my servers ip.


You don't have to edit the nameservers for your ISP or company. by definition, your domain has its OWN nameserver!

I hope you read that explanation of DNS (I don't think you did).

BUT - mostly your problem is this:

You have a corrupt zone file.

C:\Documents and Settings\jon>nslookup beautyflair.gr
*** Can't find server name for address 192.168.0.1: Non-existent domain
Server: aslan.ij.net
Address: 207.22.166.2

*** aslan.ij.net can't find beautyflair.gr: Server failed

Internic:

http://www.whois.net/whois/beautyflair.gr

WHOIS information for beautyflair.gr :

Error: Malformed requestDomain Name

.GR Domain Names check

https://grweb.ics.forth.gr/Whois?lang=en

Domain Name: beautyflair
Availability: Invalid Syntax.
Details: Domain Name:beautyflair.gr
Domain Handle:d6e49eef6dcb6471ab389e07cada7a7df-gr
Protocol Number:1287634
Creation Date:20-5-2008
Expiration Date:19-5-2012
Updated Date:12-7-2010
Registrar:Angellight
Registrar Referral URL:http://www.aws.gr
Registrar Referral Email:domains@aws.gr
Whois Server:
Bundle Name:beautyflair.gr
Name Server:ns.softgr.com

My final move were to put as dns server in domain name the ip address of my router which have as dmz host my server


Your name server (according to your zonefile) is ns.softgr.com. That is where you would enter the IP of either your router or your server, depending on how you have set things up. That is for you and your Domain Registrar to fix. Which is why I suggest you Google DNS Zone Management in the best language choice for yourself. Your problem is that you don't understand DNS. If you have a router (very likely) it will need to be configured for port forwarding on Port 80 or a DMZ will be needed. The A record for the primary host in your nameserver needs to be the external IP address of your server (it is almost certainly the WAN address of the router). Use this tool.

http://www.ipchicken.com/

This part is not an XAMPP issue, its a basic how do networks, routers and the Internet work??? question.

What I said in my last post is still true, you will need a host name to qualify the vhost on that machine.
Code: Select all
(you should make the ServerName www.beautyflair.gr and do the same for the A record in the nameserver). 


The matter of not nesting vhosts won't keep things from working, but it is a BAD idea, and you would not want to keep that concept when you do things. It will certainly lead to errors and security problems if you create .htaccess files.

I have pointed out to you the errors in configuring Apache, whether you acknowledge them or not, they are still problems that may prevent things from working.

At this point there is little more I can offer you.

Good Luck.

:!:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Xampp Vhosts

Postby johnyp » 12. July 2010 18:12

My friend JonB indeed today a registered in my domain reseller the nameserver ns.softgr.com that has the static ip of my server.
Is there any way that i can confirm that ns.softgr.com is working? Now in my domain name beautyflair.gr i set as dns my name server. Is this going to work in your opinion?

Thank you.
johnyp
 
Posts: 6
Joined: 11. July 2010 11:57

Re: Xampp Vhosts

Postby JonB » 12. July 2010 19:16

DNS changes take some time to propogate - usually 2 to 3 days, so you may not be able to tell anything until then.

But you can keep trying, it does no damage.

Did you give your server a hostname?

that would be the part to the left of 'beautyflair.gr'

like www.beautyflair.gr ??? where 'www' is the hostname. (it can be anything you want as long as it fits Doamin Name rules) But almost everyone makes their first server 'www' as that is what browsers (and users) guess first.

BTW, a server name of http://beautyflair,gr will not answer to http://www.beautyflair.gr without a CNAME entry or a Redirect directive for Apache.

Some DNS services automatically make the first A address 'www',

Whatever it is in the DNS server, it has to be an exact match in the ServerName in Apache's .conf files. That is how Apache figures out which vhost you want to talk to.

:roll:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Xampp Vhosts

Postby johnyp » 12. July 2010 23:17

Thank you all for your help. I managed to do it after i got how stuff works. Thank you again.
johnyp
 
Posts: 6
Joined: 11. July 2010 11:57


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 105 guests

cron