Virtual Hosts (XP) 1.7.7 [SOLVED]

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

Virtual Hosts (XP) 1.7.7 [SOLVED]

Postby grahammm » 14. December 2011 00:32

I've had a good search and can't see what I've done wrong:

Code: Select all
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
    ##ServerAdmin postmaster@dummy-host.localhost
    ##DocumentRoot "C:/xampp/htdocs/dummy-host.localhost"
    ##ServerName dummy-host.localhost
    ##ServerAlias www.dummy-host.localhost
    ##ErrorLog "logs/dummy-host.localhost-error.log"
    ##CustomLog "logs/dummy-host.localhost-access.log" combined
##</VirtualHost>

##<VirtualHost *:80>
    ##ServerAdmin postmaster@dummy-host2.localhost
    ##DocumentRoot "C:/xampp/htdocs/dummy-host2.localhost"
    ##ServerName dummy-host2.localhost
    ##ServerAlias www.dummy-host2.localhost
    ##ErrorLog "logs/dummy-host2.localhost-error.log"
    ##CustomLog "logs/dummy-host2.localhost-access.log" combined
##</VirtualHost>

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

<VirtualHost *:80>
 DocumentRoot "C:\domain.co.uk"
 ServerName domain.co.uk
</VirtualHost>


Any ideas?
Last edited by Sharley on 14. December 2011 22:38, edited 3 times in total.
Reason: Your domain name has been obfuscated so your post is not interpreted as spam or becomes a security risk for you.
grahammm
 
Posts: 2
Joined: 14. December 2011 00:30
Operating System: Windows XP

Re: Virtual Hosts

Postby Sharley » 14. December 2011 00:46

Please do not post your actual domain names.
Thanks. :)


The vhost for your domain needs to have permissions set for a Directory (folder) or Apache will deny access - you are missing the <Directory> directive as your vhost is outside the htdocs (Apache server DocumentRoot) folder.

For example
Code: Select all
NameVirtualHost *:80

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

<VirtualHost *:80>
ServerName domain.co.uk
ServerAlias www.domain.co.uk
DocumentRoot "C:/domain.co.uk"
<Directory "C:/domain.co.uk" >
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Save the file and restart Apache.
If Apache can't start then check the C:\xampp\apache\logs\error.log file for clues.

Your domain is registered and the DNS is pointing to your XAMPP installation PC on your ISP network.
If you have connection problems:
1. Make sure that VirginMedia do not block port 80 for cable users.
2. Make sure the ports that XAMPP uses are open in your router and firewall.
3. Allow some time for DNS to propagate if you made recent changes at your domain name registrar.

Good luck. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Virtual Hosts

Postby grahammm » 14. December 2011 12:09

Oops sorry about puting domain names, I thought I'd accidentally posted the wrong thing.

It now works, you are a genius - many thanks :-)

And Happy Christmas
grahammm
 
Posts: 2
Joined: 14. December 2011 00:30
Operating System: Windows XP

Re: Virtual Hosts

Postby Sharley » 14. December 2011 22:34

Thanks for the feedback and I am pleased you can now move forward. 8)

Apart from the spam aspect you will be amazed by the security implications of using your real details in a forum as those who wish to can use that info for devious means and so may cause a security risk for you.

Good luck and my best wishes. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 40 guests