Problem with Virtual Hosts

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

Problem with Virtual Hosts

Postby frps25 » 15. May 2009 17:18

Hello everybody

It's been impossible for me to setup a vhost in XAMPP for Linux, I've followed all documents that I've found online but problem persists. I'm using Ubuntu Jaunty 9.04 i386, xampp-linux-1.7.1

This is what I have done so far:

I've already uncommented the line in the /opt/lampp/etc/http.conf file:
Code: Select all
Include conf/extra/httpd-vhosts.conf


I've also have added the information to the /opt/lampp/etc/extra/httpd-vhosts.con file:
Code: Select all
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 /opt/lampp/htdocs
    ServerName localhost
    ServerAlias www.localhost.com
    ErrorLog logs/localhost-error_log
    CustomLog logs/localhost_log common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot /opt/lampp/htdocs/testsite1
    ServerName testsite1.com
    ErrorLog logs/testsite1-error_log
    CustomLog logs/testsite1-access_log common
</VirtualHost>


I've changed /etc/hosts file with the appropriated entries:
Code: Select all
127.0.0.1       testsite1.com


Of course I've created the respective folder: /opt/lampp/htdocs/testsite1

If I type "localhost" or "127.0.0.1" in Firefox I get to the XAMPP page, which is what I want and it's fine, BUT, if I try to access "http://testsite1.com" the browser doesn't opens any index file, what's more, it prompts me to download a PHTML file which contains the following text:

Code: Select all
<?php
   if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
      $uri = 'https://';
   } else {
      $uri = 'http://';
   }
   $uri .= $_SERVER['HTTP_HOST'];
   header('Location: '.$uri.'/xampp/');
   exit;
?>
Something is wrong with the XAMPP installation :-(


The strange thing is that a similar setup works perfectly on Windows, of course with the appropriated differences in folder structure.

Any hints on this?

Oh! I forgot, I removed everything and then reinstalled at least three times, checking all steps from ground up, and the problem repeated itself
frps25
 
Posts: 2
Joined: 15. May 2009 16:56

Re: Problem with Virtual Hosts

Postby frps25 » 16. May 2009 18:25

OK, seems I've found the solution, as you might guess it's one of those cases were you wanna slam your head against the wall for not trying it previously.

I simply cleared Firefox's cache and it started working as supposed, duh! :oops: :roll:

Hope this helps someone and don't spend two days like me all over the web
frps25
 
Posts: 2
Joined: 15. May 2009 16:56

Re: Problem with Virtual Hosts

Postby Deepspin » 30. May 2009 10:56

Thanks for posting your solution. It always helps. I know from experience it's hard when your feeling stupid but it's a great reminder for anyone else.

How often is the obvious and simplest solutions the right ones?!
Deepspin
 
Posts: 2
Joined: 30. May 2009 10:49


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 36 guests