Virtual host issues

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

Virtual host issues

Postby MasterGberry » 21. June 2011 04:14

Nvm...found this after posting

viewtopic.php?f=16&t=47306

Thanks for the help :)

When I was at my college in school i did not seem to be having issues. Now I have forwarded port 80 on my router and my virtual host file was not working even for my own computer at first.

When i would visit http://www.dev2.voobly.com I would get a blank screen. Now it seems to be working after a few days.

There still seems to be a problem, when external computers try to access it the server thinks they are trying to access /xampp and say no.

How can i fix this re-direct/problem?

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 127.0.0.1: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>

#NameVirtualHost 127.0.0.1:80
#<VirtualHost 127.0.0.1:80>
# DocumentRoot C:/xampp/htdocs/    # change this line with your htdocs folder
#  ServerName localhost
#</VirtualHost>

#<VirtualHost 127.0.0.1:80>
#   ServerAdmin webmaster@localhost
#   DocumentRoot C:/xampp/htdocs
#   ServerName testproject

#   <Directory "C:/xampp/htdocs">
#      Options Indexes FollowSymLinks Includes ExecCGI
#      AllowOverride All
#      Order allow,deny
#      Allow from all
#   </Directory>
#</VirtualHost>

<VirtualHost www.dev2.voobly.com>
  DocumentRoot "C:/xampp/htdocs/voobly/public_html"
  ServerName www.dev2.voobly.com
  ServerAlias www.dev2.voobly.com

  CustomLog "C:/xampp/htdocs/voobly/public_html/www.dev2.voobly.com-access_log" combined
  ErrorLog "C:/xampp/htdocs/voobly/public_html/www.dev2.voobly.com-error_log"

  <Directory "C:/xampp/htdocs/voobly/public_html">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>
MasterGberry
 
Posts: 3
Joined: 21. June 2011 04:12

Re: Virtual host issues

Postby Altrea » 21. June 2011 04:40

The question is: why do you need / want VirtualHosts?

You only have one domain.
Your Apache isn't configured to seperate for domain names (NameVirtualHost line)

Sure, your VHost configuration isn't right too.
For examples check the Namebased Virtual Hosts Documentation or take a board search.

One last hint: If you want to use VHosts, it is helpful to use the first VHost as localhost vhost, because the first Vhost is the one that matches every time none of the other vhosts matches. Debugging can a little bit easier with that.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Virtual host issues

Postby Sharley » 21. June 2011 04:55

I am assuming that the domain name you have posted about is a fully qualified domain name accessible via DNS from your domain name registrar and pointing to the IP address of the Apache server on your PC.
Try this by copy and paste over your existing entry:
Code: Select all
NameVirtualHost *:80

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

<VirtualHost *:80>
ServerName dev2.voobly.com
ServerAlias www.dev2.voobly.com
DocumentRoot "C:/xampp/htdocs/voobly/public_html"
<Directory "C:/xampp/htdocs/voobly/public_html" >
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
CustomLog "C:/xampp/htdocs/voobly/public_html/dev2.voobly.com-access_log" combined
ErrorLog "C:/xampp/htdocs/voobly/public_html/dev2.voobly.com-error_log"
</VirtualHost>

Make sure that your windows host file has this entry as the first entry in the list
Code: Select all
127.0.0.1 localhost
Save the file and restart Apache then test the connection is being served by Apache.

You should also still be able to access the default http://localhost as usual.

EDIT:
Sorry didn't see you edited your post while I was compiling a reply and I see that you also have the vhosts up and running successfully.
Good luck and 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 115 guests