Page 1 of 2

[Really need help!] Problems with VirtualHosts

PostPosted: 10. March 2009 21:29
by narox
hello, i have some problems with the virtualhosts...

i have bought 2 domain names, (domain1.net and domain2.cl), well my problem is that i have tryed to put them too locating to my computer but in diferent folders. domain1 in c:\domain1 and domain 2 in c:\domain2, now i put this in my httpd-vhost.conf

Code: Select all
<VirtualHost domain2.cl:80>
   ServerAdmin myownemail@domain.com
   ServerName domain2.cl:80
   DocumentRoot "c:/domain2"
   <Directory "c:/domain2">
      Options Indexes FollowSymLinks
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>


ok.. the problem is that the 2 domains point me to the htdocs folder of xampp!

i will put my httpd-vhost.conf if someone can find a problem, correct me please.

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 domain2.cl:80>
   ServerAdmin myownemail@domain.com
   ServerName domain2.cl:80
   DocumentRoot "c:/domain2"
   <Directory "c:/domain2">
      Options Indexes FollowSymLinks
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>


well... lets see if someone can help!

bye!

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 12. March 2009 04:55
by Izzy
Which version of Windows?
Which version of XAMPP?
Both omitted.

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 12. March 2009 06:27
by make-fun
Hi there

A proper VirtualHost looks like:
Code: Select all
<VirtualHost *:80>
 ServerName www.domain2.tld
 ServerAlias www.domain2.tld *.domain2.tld

 DocumentRoot "c:/domain2/"
 ErrorLog "c:/domain2/xx_error.log"
 TransferLog "c:/domain2/xx_access.log"
   <directory 'c:/domain2/'>
       Options Indexes FollowSymLinks Includes execCGI
      AllowOverride None
      Order Allow,Deny
      Allow From All
  </directory>
</VirtualHost>


Cheers

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 12. March 2009 23:36
by narox
when you write domain2.tld is same that write blogux.net?

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 13. March 2009 00:28
by make-fun
I just picked up on your naming conventions…, so if you're asking "writing domain2.tld is the same as writing blogux.net?"
yes, this is correct!
(.tld is just short for TopLevelDomain…)

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 13. March 2009 01:07
by narox
OOOOOOOOOOOOOOOOHHHHHHHHHHHHHHHHHHHHHH NICE MAN!!!!!!!!!!! YOU ARE THE BEST!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! but i have reinstalled xampp :P, YOU ARE THE BEST MAN!!!

it is so useful!!!

but i have Another question with the same subject... well the problem is that if i write http://blogux.net it sends me htdocs folder... not to c:/webs/blogux... well, but if i write http://www.blogux.net it sends me to c:/webs/blogux... how can i do it to go c:/webs/blogux writing http://blogux.net wit out the www.


thanks! you are the best ;)

i have another problem too!.. the problem is that i cannot see my forum images :/

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 13. March 2009 01:47
by Izzy
Please paste your httpd-vhosts.conf file like you did in your first posts so it can be looked at and a solution offered back.

Your current httpd.conf file is incorrect if you are using the example from the previous poster and will be giving errors which will mean that you are being sent to the default XAMPP Welcome Page, a true sign you have problems in your vhosts file.

Also a forum search in the XAMPP for Windows forum for keyword vhosts will give many working examples.

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 13. March 2009 01:49
by make-fun
It be a good idea to post the part of your VirtualHost causing the problems for you…
Guessing — I'd say look into this part:
Code: Select all
<directory 'c:/domain2/'>
       Options Indexes FollowSymLinks Includes execCGI
      AllowOverride None
      Order Allow,Deny
      Allow From All
</directory>

and try using "Options Indexes FollowSymLinks Includes execCGI"

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 13. March 2009 01:54
by make-fun
Hmm, Izzy was faster… about posting your VirtualHost

@Izzy
why do you think he's gonna get errors, please?

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 13. March 2009 02:08
by narox
[peace]Stop Fighting!! :P[/peace]
Thanks For Reply so fast!, well i will post my httpd-vhost.conf so if you find a problem with my second error (when i write httpd://blogux.net it sends me to xampp page (like localhost), and when i write http://www.blogux.net it sends me to the page that i want (c:/webs/blogux)...

now vhosts.conf...
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>


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

# Envitrina
<VirtualHost *:80>
ServerName www.envitrina.cl
ServerAlias www.envitrina.cl *.envitrina.cl
DocumentRoot "c:/webs/envitrina"
ErrorLog "c:/webs/envitrina/xx_error.log"
TransferLog "c:/webs/envitrina/xx_access.log"
   <directory 'c:/webs/envitrina'>
       Options Indexes FollowSymLinks Includes execCGI
      AllowOverride None
      Order Allow,Deny
      Allow From All
  </directory>
</VirtualHost>

# Blogux
<VirtualHost *:80>
ServerName www.blogux.net
ServerAlias www.blogux.net *.blogux.net
DocumentRoot "c:/webs/blogux"
ErrorLog "c:/webs/blogux/xx_error.log"
TransferLog "c:/webs/blogux/xx_access.log"
   <directory 'c:/webs/blogux'>
       Options Indexes FollowSymLinks Includes execCGI
      AllowOverride None
      Order Allow,Deny
      Allow From All
  </directory>
</VirtualHost>


well bye and thanks you izzi and make-fun
;)

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 13. March 2009 02:17
by make-fun
No fighting here -- don't worry -- just expressing my interest…

Think your close… this has probably to do with your host file, missing an entry for http://blogux.net
Pls post host file…

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 13. March 2009 02:31
by Izzy
Here is a complete httpd-vhosts file using the information you have already supplied.

Also make sure that your apache\conf\httpd.conf file is set as the defaults that were in place when you installed XAMPP - for example no changes.
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>

NameVirtualHost *:80

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

# Envitrina
<VirtualHost *:80>
ServerName envitrina.cl
ServerAlias www.envitrina.cl
DocumentRoot "C:/webs/envitrina"
<Directory "C:/webs/envitrina">
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
CustomLog "C:/webs/envitrina/xx_access.log" combined
ErrorLog "C:/webs/envitrina/xx_error.log"
LogLevel error
</VirtualHost>

# Blogux
<VirtualHost *:80>
ServerName blogux.net
ServerAlias www.blogux.net
DocumentRoot "C:/webs/blogux"
<Directory "C:/webs/blogux">
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
CustomLog "C:/webs/blogux/xx_access.log" combined
ErrorLog "C:/webs/blogux/xx_error.log"
LogLevel error
</VirtualHost>
Try this by copy and paste over your existing file and see how it goes.

Note - use double quotes " " only not single quote ' '
You also had a double entry for your ServerName and your ServerAlias.
Lower case e execCGI to uppercase E ExecCGI.
Lower case <directory> to upper case <Directory>
AllowOverride None to AllowOverride All


Edit by dragging into your open text editor C:\Windows\system32\drivers\etc\Hosts file and making sure that the first lines look like this after the commented section.
Code: Select all
127.0.0.1 localhost
127.0.0.1 blogux.net
127.0.0.1 envitrina.cl


Let me know back if the above works and I can check from the Internet from here if all is working.

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 13. March 2009 22:40
by narox
well... thanks!

all its ok... i can see the images.. i can see all and that's all ok...

well really i don't know what to say.. hmmm well.. izzi and make-fun... a last question.. can i add karma to your users or give points or something else that i can do for you two??

well really thanks... im so happy :)

well.. bye ;)

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 14. March 2009 04:28
by Izzy
Your welcome and thanks for posting back that all is now working - I checked your sites from here and both display well.

No karma or points needed and not available anyway on this forum.

Good luck and now enjoy your XAMPP experience.

Re: [Really need help!] Problems with VirtualHosts

PostPosted: 14. March 2009 22:17
by narox
well, bye.. thanks you all!! :)