You don't have permission to access / on this server

Asked by Daf Hobson

Running Jaunty on amd 64bit dual core since June 09. Apache2 installed by LAMP.
Modified the /etc/apache2/sites-available/default from /var/www to /home/user/PUBLIC_HTML/website-folder. Works OK - and does on my old Heron 8.04 as well.

Purpose. To preview the website I do which are written in php (Using Quanta)

Suddenly on the AMD Jaunty 9.04, when I go http://localhost/ I'm getting :-

FORBIDDEN You don't have permiss to access / on this server. Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch Server at localhost Port 80

Got all folder and file permissions to flow (something changed them maybe) Still no good.
Looked at the conversation about IPv6 confusing with IPv4.

Even tried their solutions but I'm not familiar enough to get it right -if that's what it is.

I also replaced the apache2/sites-avail/default to point back to /var/www and 'It Works!' shows up as it should; then went back to my web folder - but nope...!

I do machine re-boot everytime I change apache2.

I am stuck after trying for hours.
Can anyone help?

Question information

English Edit question
Ubuntu apache2 Edit question
No assignee Edit question
Solved by:
Daf Hobson
Last query:
Last reply:
Revision history for this message
Daf Hobson (daf-dafhobson) said :

Ongoing - more coffee:-

Complete removal of apache2 using Synaptic.
Complete Re-installation of apache2
http://localhost/ now gives a different message:-

Not Found
The requested URL / was not found on this server.
Apache/2.2.11 (Ubuntu) Server at localhost Port 80

All the permissions from home/user/folder/web-folder/index.php - are checked and both 'owner' and 'group' owner are to user with all permissions at drwxr-xr-x

Still no joy

Too much caffeine... help!

Revision history for this message
Daf Hobson (daf-dafhobson) said :

So I used CLI to restart apache2 to save time and got this message about VirtualHosts:-

user@puter:~$ sudo /etc/init.d/apache2 restart
[sudo] password for user:
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
[Mon Jul 20 18:23:11 2009] [warn] NameVirtualHost *:80 has no VirtualHosts
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
[Mon Jul 20 18:23:12 2009] [warn] NameVirtualHost *:80 has no VirtualHosts [ OK ]

Revision history for this message
Daf Hobson (daf-dafhobson) said :

Complete removal of apache2 and php5 via synaptic.
apt-get install can't even get 'It Works!'

Revision history for this message
Ufuk (ufukkilicaslan) said :

I followed these steps to change the default site directory for apache and I've had no problems. I think you should follow this according to your directory names and should not forget the last two command to activate your new site.

Taken from:

Virtual Hosts

Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available. By default, there is one site available called default this is what you will see when you browse to http://localhost or You can have many different site configurations available, and activate only those that you need.

As an example, we want the default site to be /home/user/public_html/. To do this, we must create a new site and then enable it in Apache2.

To create a new site:

Copy the default website as a starting point. sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite

Edit the new configuration file in a text editor "sudo nano" on the command line or "gksudo gedit", for example: gksudo gedit /etc/apache2/sites-available/mysite

Change the DocumentRoot to point to the new location. For example, /home/user/public_html/

Change the Directory directive, replace <Directory /var/www/> to <Directory /home/user/public_html/>

You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites
Save the file

Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enable site) and a2dissite (apache2disable site).

sudo a2dissite default && sudo a2ensite mysite

Finally, we restart Apache2:

sudo /etc/init.d/apache2 restart

Revision history for this message
Daf Hobson (daf-dafhobson) said :

Many thanks for your reply.
The proceedure you quote above is familiar to me and I have set up apache2 in XP and Ubuntu 8.04 several times.
(I learned some extra things from your lines above. thanx)

I set up apache2 in June 09 on an AMD 64bit Dual Core running Jaunty 9.04 and had apache2 working good... until the other day (Sunday) when apache2 stopped delivering 'mysite' on the http://localhost/ call.

After two complete removals via Synaptic . One re-install of 2.2.11 via Synaptic - and the last re-install via 'apt-get install apache2' .... I do NOT get 'It Works!' by http://localhost/

Apache2 resides as it should in /etc. The html containing 'It Works!' resides in the html file in /var/www as it should.

 'It Works!' does not appear either with http://localhost/ or at present, with apache2 installed by 'sudo apt-get install apache2' as given in

Very many thanks

Revision history for this message
Daf Hobson (daf-dafhobson) said :

Realised this forum is for bugs and developers
Appologies for the intrusion.

Revision history for this message
Jeruvy (jeruvy) said :

Ah no intrusion...

Actually this 'forum' as you call it is to 'help bug trackers and developers', but it's prime focus is to answer ANYONE's questions.

I'm still unclear if you need help or not still, or if the question has been answered for you. If it has, then please mark this as 'Solved', and feel free to ask another question anytime. If not, then just re-summarize what question remains unanswered.

Revision history for this message
Daf Hobson (daf-dafhobson) said :

Thanks for your answer.
As with arty farty people like me; after a while one has been through so many loops and so many hours of frustration that one looses track of the aim and the process. Somehow I got it going.
What might help others who read this post is what worked for me.

I tried to remove apache2 in synaptic ... a 'complete' removal that is.
I discovered that many files were still in place; eg /etc/apache2
I tried -purge. This didn't clear my machine either.
I tried 'find' and manually deleted the entire list. (By now I didn't care if I lost the machine) I diodn't loose the machine but didn't clear apache2 from jaunty.

Eventually I found this line in Ubuntu forums:-

sudo apt-get remove --purge $(dpkg -l apache* | grep ii | awk '{print $2}') && sudo apt-get install apache2

and I found it at:-

It worked 'out of the box' as it were. apache2 went stright in to Jaunty and worked; and I now need to study it to understand what the first half of the line before 'pipe' means.

I had to repeat the whole 'permissions' nightmare in order to get apache2 to render my website - which it now does as it should.

The only connundrum I cannot solve is that I had been through that 'permissions' nightmare previously and am familiar with what to do. Hey ho. For all the agony I've been with Ubuntu over a year and now cannot stand looking at the 'other' operating system.