Vhosts

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

Vhosts

Postby mbmichele » 14. January 2007 18:08

Sorry I ask help, but previous post not help me.

Vhosts not working but this pieces of codes was working on my manual installation of apache alone.

How can I correct config?
this is my :

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 webmaster@dummy-host.example.com
##    DocumentRoot /www/docs/dummy-host.example.com
##    ServerName dummy-host.example.com
##    ServerAlias www.dummy-host.example.com
##    ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
##    CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common
##</VirtualHost>

##<VirtualHost *:80>
##    ServerAdmin webmaster@dummy-host2.example.com
##    DocumentRoot /www/docs/dummy-host2.example.com
##    ServerName dummy-host2.example.com
##    ErrorLog @rel_logfiledir@/dummy-host2.example.com-error_log
##    CustomLog @rel_logfiledir@/dummy-host2.example.com-access_log common
##</VirtualHost>
<VirtualHost 127.0.0.6:80>
    ServerAdmin sql@localhost
    DocumentRoot "C:/Programmi/xampp/htdocs"
    ServerName 127.0.0.6
    ServerAlias www.dummy-host.example.com
</VirtualHost>
<VirtualHost 127.0.0.2:80>
    ServerAdmin sql@localhost
    DocumentRoot "C:/internet/MBWeb2/SQL_locale"
    ServerName sql
</VirtualHost>
<VirtualHost 127.0.0.3:80>
    ServerAdmin sql@localhost
    DocumentRoot "C:/Programmi/Apache Group/Apache2/htdocs/"
    ServerName apache
</VirtualHost>
<VirtualHost 127.0.0.4:80>
    ServerAdmin sql@localhost
    DocumentRoot "C:/internet/MBWeb2/EasyBannerPro/"
    ServerName banner
</VirtualHost>
<VirtualHost 127.0.0.5:80>
    ServerAdmin sql@localhost
    DocumentRoot "C:/internet/MBWeb2/phplist_web/"
    ServerName test
</VirtualHost>
#lmasetting
<files directory>
ForceType application/x-httpd-php

</files>
#lmasettingend

<FilesMatch "banner_468_inviti_gmail.gif">
ForceType application/x-httpd-php
</FilesMatch>
<FilesMatch "inviti_gmail.gif">
ForceType application/x-httpd-php
</FilesMatch>



The config is only for test my web site on my PC the site stay on Private Hosting.

Thanks Michele
User avatar
mbmichele
 
Posts: 3
Joined: 14. January 2007 17:50

Postby Izzy » 15. January 2007 00:13

Hello Michele,

Vhosts not working but this pieces of codes was working on my manual installation of apache alone.

Very important - XAMPP needs to be the only server on port 80 on your PC or XAMPP will not work.
If you have another instance of Apache listening on port 80 then you should change the listening port to another or uninstall it.
Run xampp\xampp-portcheck.exe to make sure XAMPP has exclusive use of the ports it requires.
The ports XAMPP require can be found here:
http://localhost/security/
or from the Security menu option in the XAMPP Welcome Page.



This means you are using name based virtual hosts but you are using IP based virtual hosts:
NameVirtualHost *:80
http://httpd.apache.org/docs/2.2/vhosts ... l#purename

So this should be commented out as you are not using it here:
# NameVirtualHost *:80
http://httpd.apache.org/docs/2.2/vhosts ... es.html#ip

Note:
If you want to use name based virtual hosts then you would uncomment the above and replace the <VirtualHost 127.0.0.2:80> with <VirtualHost *:80>
This part of your virtual host configuration file may appear to be complicated but the Apache manual examples above should help clear things up for you.
In your case using an IP based system is just fine.



This is the XAMPP default localhost and should be changed:
<VirtualHost 127.0.0.6:80>
ServerAdmin sql@localhost
DocumentRoot "C:/Programmi/xampp/htdocs"
ServerName 127.0.0.6
ServerAlias www.dummy-host.example.com
</VirtualHost>


Change it so it looks like this:
<VirtualHost 127.0.0.1:80>
ServerAdmin admin@localhost
DocumentRoot "C:/Programmi/xampp/htdocs"
ServerName localhost
</VirtualHost>

The other directives for the localhost are covered in the httpd.conf file.


The following containers should look similar to this one:
<VirtualHost 127.0.0.2:80>
ServerAdmin sql@localhost
DocumentRoot "C:/internet/MBWeb2/SQL_locale"
ServerName sql
<Directory "C:/internet/MBWeb2/SQL_locale">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Just replace the IPs and paths in the other containers and add the Directory directive.

Your Windows System hosts file should be edited to include all your above IP and ServerName (hosts) combinations.
Drag the file into your text editor to view and edit this file. Then after editing save the file.
C:\WINDOWS\system32\drivers\etc\hosts

It should look similar to this:
127.0.0.1 localhost
127.0.0.2 sql
127.0.0.3 apache
127.0.0.4 banner
127.0.0.5 test

With the container using the ServerName of test you might want yo consider changing it to some other ServerName, for example - testserver.
The name test is often a protected name and so to avoid possible later conflicts it would be advisable to change it both in the VirtualHost container and in the hosts file.

ServerName should be a fully qualified domain name which you are setting in your hosts file:
http://httpd.apache.org/docs/2.2/mod/co ... servername

Find an index of Server Directives here for future referrence:
http://httpd.apache.org/docs/2.2/mod/directives.html

Remember to backup any configuration files before editing and restart apache after editing to have the changes recognised.



:?:
#lmasetting
<files directory>
ForceType application/x-httpd-php

</files>
#lmasettingend

<FilesMatch "banner_468_inviti_gmail.gif">
ForceType application/x-httpd-php
</FilesMatch>
<FilesMatch "inviti_gmail.gif">
ForceType application/x-httpd-php
</FilesMatch>


Not sure what all this is about but I would comment it out (add a # at the start of each line) until you get the virtualhost containers working.
Then you can uncomment it again after checking what you have typed using the above Apache index of Server Directives link.
Then if your server won't start you will know that the Files directives may be at fault.

I don't think these Files directives are needed or even if they are correct, whilst you are using XAMPP but I could be wrong as I don't know why you are using them in the first place.
Maybe something you need on your Private Hosting server?


Good luck :)
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby mbmichele » 15. January 2007 08:45

Thanks.

Previous installation of apache was disinstalled before installing xampp.

This:
Code: Select all
#lmasetting
<files directory>
ForceType application/x-httpd-php

</files>
#lmasettingend

<FilesMatch "banner_468_inviti_gmail.gif">
ForceType application/x-httpd-php
</FilesMatch>
<FilesMatch "inviti_gmail.gif">
ForceType application/x-httpd-php
</FilesMatch>


Was for particular script php ( directory:http://www.onlinemarketingtoday.com/ e my gif handled as php)

Now I'll trying it.
Thanks more.

Michele
User avatar
mbmichele
 
Posts: 3
Joined: 14. January 2007 17:50


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 146 guests