cant get virtualhost to work on ubuntu 11.10 - apache2?

1k Views Asked by At

can anybody shed some light on this ? I can't seem to be able to get a virtualhost setup to work , I'm new to ubuntu (not convinced yet ?) I have installed a lamp server which is working ok.

I have copied the default from sites-availably named it example, i have created the directory at /var/www/example and put in an index file

I have used a2ensite example and have restarted the server then entered 127.0.0.1/example in the browser but get:

Not Found

The requested URL /example was not found on this server.

Apache/2.2.20 (Ubuntu) Server at 127.0.0.1 Port 80

this is what i have in example:

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName example
DocumentRoot /var/www/example 
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/example/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

<VirtualHost>

Can anybody help thanks

2

There are 2 best solutions below

0
On BEST ANSWER
1
On
  • You forgot the / in the closing VirtualHost tag.
  • if you specify DocumentRoot /var/www/example you are already in the /example folder, so you can access your index file with http://127.0.0.1/ - 127.0.0.1/example points to /var/www/example/example.