Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Technical Support _ Configuring Name Based Virtual Hosts

Posted by: chrisss Nov 15 2002, 08:08 AM

Ive been trying to set up a namevirtualhost just as a project running on my own computer, ive altered my hosts file which
looks like this
127.0.0.1 localhost.localdomain localhost
127.0.0.1 www.peta.com.au

then i added to the httpd.conf

NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName www.peta.com.au
DocumentRoot /home/peta/web
<Directory /home/peta/web>
Order allow, deny
Allow from all
</Directory>
</VirtualHost>

I have an index file in the above document root.

When i type in the address into the browser i get an error msg
saying i dont have permission to access /

it dont seem to matter where i define the document root for the virtual host
...i always get the same message.. plus defining a namevirtual host seems to
stop me accessing any file ...i get the same msg even for the localhost but
soon as i comment out the namevirtualhost directives the localhost works
fine.


thanks chris

Posted by: chrisw Nov 15 2002, 09:10 AM

you cant use 127.0.0.1 as a name virtual host ip address

how is this server connected to the internet...behind a firewall by itself
on the internet or is it behind a router?

Posted by: chrisss Nov 15 2002, 07:42 PM

hi
everything is running localy on my machine as local host 127.0.0.1

its just a project im doing ... i want to configure apache and have a few sample datadriven sites running

cheers chris

Posted by: chrisw Nov 15 2002, 11:04 PM

what are you trying to access as the index page....
a perl file.....cgi-file, php file or a regular index.html page?

the acces denied error is cause by not having
the proper permissions set on the root directory of
the www set properly.....

what are the permissions set at on the htdocs folder
and what user/group is your webserver running as?

Posted by: chrisss Nov 17 2002, 05:54 AM

im trying to access a normal index.html file

everything is fine until i add the directives to namevirualhost ...if i comment these out i can access the local host index file and any other file ive placed into var/www/html eg:http//:localhost/test.php

i havent altered any of the dierectory permissions

apache is

d-wx-wx-wt 2 apache apache

www is

drwxr-xr-x root root

html is

wxr-xr-x root root

hope this helps

cheers chris


ps ...how do i unlock the cdrom drive ...even when logged as root i cant access this or the floppy ..they both have a small padlock on them?

Posted by: bensode Nov 18 2002, 11:46 AM

Couple of flaws ...

<Quote>
Ive been trying to set up a namevirtualhost just as a project running on my own computer, ive altered my hosts file which
looks like this
127.0.0.1 localhost.localdomain localhost
127.0.0.1 www.peta.com.au
</QUOTE>

you shouldn't name like that to same IP in that manner to localhost. Try
127.0.0.1 localhost.localdomain localhost
127.0.0.2 www.peta.com.au


Second ... apache changed it's Vhost syntax in the httpd.conf with recent patches to exploits in vhosting. What is your version of apache? Check the latest docs on Vhosting on the apache site http://httpd.apache.org/

Hope that helps ...

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)