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

I just install apache2 on ubuntu,the default www directory is /var/www/ ,I use ln to link it to '/media/Software/Program Files/wamp/www/' at the windows directory,but the apache shows 'You don't have permission to access / on this server',Then I use 'sudo chmod -R 777 /media/Software/Program\ Files/wamp/www/' to set the permission,but it didn't work,and nothing changed when I saw the permission in the preporties of the '.../wamp/www' folder.So I want to know How can I change the www directory to '.../wamp/www' as I also need to access this diretory in windows.

3 Answers

There are two things around.

One is whether Apache is allowed to follow symlinks. Is you link a symlink via ln -s? It is the recommended way but it might be a security issue in some servers and it is disabled many times.

See for more info on that topic but esentially you need AllowOverride None as here:

<Directory /> Options FollowSymLinks
</Directory>

Other topic is the permissions.

Windows Partition

As it is a Windows directory (it seems so) the best option will be to follow this guide :

Essentially it recommends you to edit the /etc/fstabThe line should be like this one:

/dev/sdb5 /media/Software ntfs-3g defaults, ..., umask=227 0 0

The interesting part is the umask. I will recommend to put the last digit as 6 or 7 for allowing Apache to access.

The recommended way is to use UUID. The steps are:

0) Make a backup of fstab (just in case ;))

sudo cp /etc/fstab /etc/fstab.bak

1) Get the UUID of your hard-drive:

sudo blkid

2) Add the line in fstab

It should be something like this:

UUID=$you_uuid /media/Software ntfs-3g defaults,user,auto,utf8

I have added auto so that it auto mounts. If you don't want that use noauto instead.

This will give it full permission. If you prefer different permissions use dmask=000,fmask=111 as options. Instead of the it uses different numbers than chmod. If you want you can add also uid=100,gid=100 with the wanted another uid or gid.

References:How to automount NTFS partitions?

Linux/Unix Partition (if not using Windows partitions)

If it is not a Windows partition the permissions should be in the standard linux way.

The best option is to change the permission of that directory. I will do it in this way:

chgrp -R www-data /media/Software/Program Files/wamp/www/

Also you will need read permission (maybe write) for that directory. It is done in this way:

chmod g+r /media/Software/Program Files/wamp/www

For also adding write:

chmod g+rw /media/Software/Program Files/wamp/www

But again that won't work if the partition is a NTFS partition because Windows do not store permission in the disk in this way.

6

Assuming you have a default Apache install, you should update the DocumentRoot directive inside /etc/apache2/sites-enabled/000-default and have this it point to /media/Software/Program\ Files/wamp/www/

DocumentRoot /media/Software/Program\ Files/wamp/www

Further infos can be found here:

1

For me the problem was none of the above but something much simpler.

I had two Apache2 virtual hosts competing for the same domain name in the ServerAlias line.

In one virtual host file, I had

ServerAlias mysubhost.myhost.me

but in the other virtual host file I had a wildcard entry:

ServerAlias *.myhost.me

This caused a conflict in Apache 2. Removing the wildcard entry (with the *) solved the problem for me.

(Taken from (K)Ubuntuguide at .)

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like