Page 1 of 1

virtual host in ubuntu

PostPosted: 30. March 2007 17:23
by fuzz
hi there!

i just tried to set up an xampp development environment just as i've done it under windows. what i wanted to have is:

leave http://localhost mapped to the default htdocs directory with all its standard content.
link http://localdev to a directory specified by me, in this case ~/Web/Root.

in windows i've already done this successfully. i set up the localdev host in the hosts file and added both localhost and localdev as virtualhost in httpd-vhost.conf. it works as expected.

in ubuntu this doesn't work. i downloaded and extracted xampp correctly under /opt. the standard stuff is accessible via http://localhost. everything is fine. now i wanted to set up my environment as i have under windows but i fail.

my vhosts.conf:
Code: Select all
NameVirtualHost *:80


<VirtualHost *:80>
    ServerName localhost:80
    DocumentRoot "/opt/lampp/htdocs"
</VirtualHost>

<VirtualHost *:80>
    ServerName localdev:80
    DocumentRoot "/home/fuzz/Web/Root/www"
</VirtualHost>


included in my httpd.conf:
Code: Select all
ServerRoot "/opt/lampp"
Listen 80

ServerAdmin you@example.com
ServerName localhost
DocumentRoot "/opt/lampp/htdocs"

<Directory />
    Options FollowSymLinks
    AllowOverride None
    #XAMPP
    #Order deny,allow
    #Deny from all
</Directory>

<Directory "/opt/lampp/htdocs">
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

<IfModule alias_module>
     ScriptAlias /cgi-bin/ "/opt/lampp/cgi-bin/"
</IfModule>

<Directory "/opt/lampp/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

EnableMMAP off
EnableSendfile off

# Server-pool management (MPM specific)
#Include etc/extra/httpd-mpm.conf

# Multi-language error messages
#Include etc/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
Include etc/extra/httpd-autoindex.conf

# Language settings
#Include etc/extra/httpd-languages.conf

# User home directories
#Include etc/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include etc/extra/httpd-info.conf

# Virtual hosts
Include /home/fuzz/Web/vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include etc/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include etc/extra/httpd-dav.conf

# Various default settings
Include etc/extra/httpd-default.conf

# XAMPP
Include etc/extra/httpd-xampp.conf


i deleted all lines which should have nothing to do with the problem that i know of.

here's the output of httpd -S:
Code: Select all
fuzz@pcfuzz:~/$ /opt/lampp/bin/httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:*                    is a NameVirtualHost
         default server localhost (/home/fuzz/Web/vhosts.conf:3)
         port * namevhost localhost (/home/fuzz/Web/vhosts.conf:3)
         port * namevhost localdev (/home/fuzz/Web/vhosts.conf:8)
Syntax OK


what happens when i try and get http://localdev via browser is that i get redirected to the http://localhost document root directory which is redirecting me automatically to the /xampp which should be ok for http://localhost. but i've got the address http://localdev/xampp in the browser then, getting a 404 not found.
furthermore, when i delete the virtualhost entry for localhost, i get an 404 when accessing http://localhost as expected. but i get still redirected to the /xampp subdir. this even happens when localhost is not defined as virtualhost and i access http://localdev.

in short: http://localdev is translated internally to http://localhost

this seems not correct to me. if you could help me or point me to an solution i'd be very grateful.

thanks in advance, fuzz.

PostPosted: 30. March 2007 17:56
by Wiedmann
Clear your browser cache.

PostPosted: 30. March 2007 18:14
by fuzz
i've already tried that, it does not work. i'm using firefox so this should be no problem since it does not cache whole pages. at least i've never experienced anything like that.

any other suggestions? has anyone got such a configuration running under ubuntu?

PostPosted: 08. April 2007 11:45
by juno_939
Please excuse my english because is too bad.

Well I think that you forgot to do one thing. In windows you must edit the host file (c:\windows\drivers\etc\host) because you need to say to windows how many host there are in your computer.

You must do the same in ubuntu, see this http://ubuntuforums.org/showthread.php? ... osts+xampp

I can't explain better in english, but in this topic of ubuntu forums explains how to do it.

I expect that this post will be useful for you.

Once again sorry for my bad english