virtual host - help please, its doing my head in.

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

virtual host - help please, its doing my head in.

Postby grizlyadams » 10. March 2009 20:05

hi,

firstly let me just say that I'm an IIS guy. Had to install WAMP of some sort to run a website and chose XAMPP as it looked (and has thus far proven to be) simple.

I've installed it and it runs fine. I have iis on the same server, so had to make sure the iis iplist was limited and it didn't socket pool etc., but got that sorted fine. Now all i want to do is run a website on the xampp install. if I go to the ip address i get the xampp welcome page, I can administer mysql, email works everything fine. I have a new website (lets call it MySite), I've copied the webite and its sub-directories to c:\xampp\htdocs\MySite and my conf\extra\httpd-vhosts.conf looks as below. items in [] are substitutes for the real data.

My problem is that if i go to http://www.mysite.com i get the xampp welcome page . . . I've been going round and round all afternoon with this, and I can't get it to work. Doubtless I'm missing some directive somehwere, but I can't find it :(

any help will be mostly greatfully recieved.


---------------------------------------------------
# Ensure that Apache listens on port 80
Listen [external-ip]:80

# Listen for virtual host requests on all IP addresses
NameVirtualHost [external-ip]:80

<VirtualHost [external-ip]:80>

DocumentRoot c:/xammp/htdocs/MySite
ServerName http://www.MySite.com

</VirtualHost>
grizlyadams
 
Posts: 11
Joined: 10. March 2009 19:50

Re: virtual host - help please, its doing my head in.

Postby Izzy » 11. March 2009 01:49

To find any possible errors in your vhosts file open a command prompt in C:\xampp\apache\bin folder and issue this command apache -S and then paste it here - the mark, copy commands can be found by double clicking on the small icon in the console window title bar left side.

start>Run..>type cmd>type cd C:\xampp\apache\bin>type apache-S

I will then take a look at your issues and posts some possible recommendations that may help with your head pain. ;)

BTW why use XAMPP when you have IIS and are familiar with it's use as I am a firm believer in simply disabling IIS if one is to use XAMPP as you may find it difficult to try and use both at once anyway.
Last edited by Izzy on 12. March 2009 07:55, edited 4 times in total.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: virtual host - help please, its doing my head in.

Postby grizlyadams » 11. March 2009 02:05

thanks Izzy

I spotted a stupid schoolbpy error on the first run which has fixed the default page (www.mysite.com) but if I go to www.mysite.com\admin\login.php is get a "object not found 404 error"

here's the output from the apache -S command - i notice that the fwdn ip is different to the mysite ip - what is the caus eof that?

=============================================================

apache: Could not reliably determine the server's fully qualified domain name, using 192.171.73.119 for ServerName
VirtualHost configuration:
192.171.73.49:80 is a NameVirtualHost
default server www.mysite.com (C:/xampp/apache/conf/extra/httpd-vhosts.conf:42)
port 80 namevhost www.mysite.com (C:/xampp/apache/conf/extra/httpd-vhosts.conf:42)
wildcard NameVirtualHosts and _default_ servers:
_default_:443 localhost (C:/xampp/apache/conf/extra/httpd-ssl.conf:74)
Syntax OK
grizlyadams
 
Posts: 11
Joined: 10. March 2009 19:50

Re: virtual host - help please, its doing my head in.

Postby Izzy » 11. March 2009 02:40

404 errors are best researched in the xampp\apache\logs\error.log file.
This address may be wrong:
http://www.mysite.com\admin\login.php <-- slashes are mixed.
perhaps
http://www.mysite.com/admin/login.php but see below for a vhost recommendation.

Your external IP is being replaced by your LAN IP and so we do not need to use an IP in your vhosts but revert to the wild card.

Also what changes, if any, have you made in the apache\conf\httpd.conf file - revert to the defaults in place when you installed XAMPP if possible.

Try this and see if it helps:
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/xampp/htdocs"
</VirtualHost>

<VirtualHost *:80>
ServerName mysite.com
Server alias www.mysite.com
DocumentRoot "C:/xammp/htdocs/mysite <-- case sensitive and I recommend lowercase always
</VirtualHost>


Open your C:\Windows\system32\drivers\etc\Hosts file in a text editor and make sure the first lines look like this:
Code: Select all
127.0.0.1 localhost
127.0.0.1 mysite.com
Save the conf and the Hosts file after editing and then restart Apache.

You should be able to go to:
http://localhost/ and see the XAMPP Welcome page.
http://localhost/mysite/ and see your mysite index page.
http://mysite.com/ should give you your site
as should
http://www.mysite.com/

If your mysite.com is setup at your domain name registrar to point to your [external IP] then from the Internet using http://www.mysite.com should give your XAMPP served web site.

As from the Internet should http://[ external IP]/

See how that goes and let me know back if it helps with the migraine. :)
Last edited by Izzy on 12. March 2009 07:57, edited 1 time in total.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: virtual host - help please, its doing my head in.

Postby grizlyadams » 11. March 2009 08:50

hi - will make the changes now. The only change I've made to the httpd.conf is to cmments out the "listen" line.

DNS is fine and mysite.com and www.mysite.com resolve to [external-ip] fine.

will report back shortly :) - thanks for you time this far.
grizlyadams
 
Posts: 11
Joined: 10. March 2009 19:50

Re: virtual host - help please, its doing my head in.

Postby Izzy » 11. March 2009 08:57

grizlyadams wrote:The only change I've made to the httpd.conf is to cmments out the "listen" line.
This would need to be uncommented and changed to Listen *:80 for a possible better effect although Listen 80 will suffice - as usual save the file and restart Apache to have the edits recognised.
Last edited by Izzy on 12. March 2009 07:59, edited 1 time in total.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: virtual host - help please, its doing my head in.

Postby grizlyadams » 11. March 2009 09:25

Izzy wrote:404 errors are best researched in the xampp\apache\logs\error.log file.
This address may be wrong:
http://www.mysite.com\admin\login.php <-- slashes are mixed.
perhaps
http://www.mysite.com/admin/login.php but see below for a vhost recommendation.

sorry - my typo there - the url works in that it allows me to login, but then fails with a 404 error - well, it did before I made the changes below :)

Your external IP is being replaced by your LAN IP and so we do not need to use an IP in your vhosts but revert to the wild card.

this server has 6 ip addresses, lets call them
123.123.123.112
123.123.123.25
123.123.123.26
123.123.123.27
123.123.123.28
123.123.123.29

.112 is the lan address, but also external, 25 thru 29 are additional addresses.
112, 25, 26, 27 are all allocated to iis6 and all have websites using them
28 is spare
29 is the one I'm trying to use for apache.

if I use * rather than an ip address in the conf files, I get a FQDN warning realting to 112 in the eventlog when I start apache

Also what changes, if any, have you made in the apache\conf\httpd.conf file - revert to the defaults in place when you installed XAMPP if possible.

Try this and see if it helps:
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/xampp/htdocs"
</VirtualHost>

<VirtualHost *:80>
ServerName mysite.com
Server alias www.mysite.com
DocumentRoot "C:/xammp/htdocs/mysite <-- case sensitive and I recommend lowercase always
</VirtualHost>


Open your C:\Windows\system32\drivers\etc\Hosts file in a text editor and make sure the first lines look like this:
Code: Select all
127.0.0.1 localhost
127.0.0.1 mysite.com
Save the conf and the Hosts file after editing and then restart Apache.

You should be able to go to:
http://localhost/ and see the XAMPP Welcome page.
http://localhost/mysite/ and see your mysite index page.
http://mysite.com/ should give you your site
as should
http://www.mysite.com/

http://localhost/ goes to XAMPP welcome page
http://localhost/mysite goes to my index page, but not pictures and all fonts incorrect )to be honest, I don't care if it works on the server - I will never need to get to it from the server really.
http://mysite.com/ and http://www.mysite.com/ both now give me 403 access denied errors. (when browsed to locally and over the internet.


If your mysite.com is setup at your domain name registrar to point to your [external IP] then from the Internet using http://www.mysite.com should give your XAMPP served web site.


As from the Internet should http://[ external IP]/

See how that goes and let me know back if it helps with the migraine. :)


when browsed remotely
http://[external-ip]/ now gives me the XAMPP welcome page
http://www.mysite.com/ gives me 403 access denied.


the migraine is getting worse!!
grizlyadams
 
Posts: 11
Joined: 10. March 2009 19:50

Re: virtual host - help please, its doing my head in.

Postby Izzy » 11. March 2009 09:32

gives me 403 access denied.
Where is your DocumentRoot now did you change it?
<VirtualHost *:80>
ServerName mysite.com
Server alias http://www.mysite.com
DocumentRoot "C:/xammp/htdocs/mysite <-- case sensitive and I recommend lowercase always
</VirtualHost>


If it is now outside of the htdocs folder we need to add a Directory directive to give the required permission and eliminate the 403 error.

Edit - sorry just spotted my typo - add the end quotes so it should be:
DocumentRoot "C:/xammp/htdocs/mysite"

Now try again.
Last edited by Izzy on 12. March 2009 08:02, edited 2 times in total.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: virtual host - help please, its doing my head in.

Postby Wiedmann » 11. March 2009 09:34

this server has 6 ip addresses, lets call them
...
123.123.123.29

29 is the one I'm trying to use for apache.

So you have to use:
httpd.conf:
Code: Select all
Listen 123.123.123.29:80


httpd-ssl.conf:
Code: Select all
Listen 123.123.123.29:443
<VirtualHost 123.123.123.29:443>
ServerName www.mysite.com:443


httpd-vhosts.conf:
Code: Select all
NameVirtualHost 123.123.123.29:80
<VirtualHost 123.123.123.29:80>
ServerName www.mysite.com:80

(Next VHost in the same way)

HOSTS:
Code: Select all
123.123.123.29 www.mysite.com

(Next VHost in the same way)

And now access your server with "http://www.mysite.com/".

(BTW: If you only host 1 site on apache, there is no need for VHosts. Just change ServerName in httpd.conf and put your files directly in htodocs.)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: virtual host - help please, its doing my head in.

Postby grizlyadams » 11. March 2009 09:56

in my fury I've just uninstalled everyting - XAMPP et al. starting from scratch now with the simple site in c:\xampp\htdocs\mysite. Too many possibilities for errors otherwise!

Yeah, I realise that i don't need vhosts if only running one site, but in all likelyhood this apache instance will run more sites so I want to get it right from the start :)

I'll make yoiur recomended changes, but to be honest that's pretty much what I thought I'd done yesterday (apart from the ssl conf file part - which may have been a prob as part of the site i'm installing uses ssl)

I shall report back shortly.

Coffee first :)
grizlyadams
 
Posts: 11
Joined: 10. March 2009 19:50

Re: virtual host - help please, its doing my head in.

Postby grizlyadams » 11. March 2009 10:20

Wiedmann wrote:So you have to use:
httpd.conf:
Code: Select all
Listen 123.123.123.29:80


httpd-ssl.conf:
Code: Select all
Listen 123.123.123.29:443
<VirtualHost 123.123.123.29:443>
ServerName www.mysite.com:443


httpd-vhosts.conf:
Code: Select all
NameVirtualHost 123.123.123.29:80
<VirtualHost 123.123.123.29:80>
ServerName www.mysite.com:80

(Next VHost in the same way)

HOSTS:
Code: Select all
123.123.123.29 www.mysite.com

(Next VHost in the same way)

And now access your server with "http://www.mysite.com/".

(BTW: If you only host 1 site on apache, there is no need for VHosts. Just change ServerName in httpd.conf and put your files directly in htodocs.)


right, done all of the above, but whne I browse remotely to http://www.mysite.com/ I get the XAMPP welcome page. . .
grizlyadams
 
Posts: 11
Joined: 10. March 2009 19:50

Re: virtual host - help please, its doing my head in.

Postby Wiedmann » 11. March 2009 10:50

but whne I browse remotely to http://www.mysite.com/ I get the XAMPP welcome page. . .

And from the server pc and not from a remote one?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: virtual host - help please, its doing my head in.

Postby grizlyadams » 11. March 2009 12:26

same thing . . .
grizlyadams
 
Posts: 11
Joined: 10. March 2009 19:50

Re: virtual host - help please, its doing my head in.

Postby grizlyadams » 11. March 2009 12:30

if I browse to http://www.mysite.com/mysite/ I get my site (remotely and locally)
grizlyadams
 
Posts: 11
Joined: 10. March 2009 19:50

Re: virtual host - help please, its doing my head in.

Postby Wiedmann » 11. March 2009 12:32

same thing . .

Then you are doing something wrong ;-)

(Or your have changed things, which we don't see)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 78 guests