Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm setting up my local LAMP server, and when I go to it, I can't follow symlinks with the Apache user (www-data). At this point, I've tried chowning and chmoding and I've added
Options FollowSymLinks to my httpd.conf file for my DocumentRoot. I'm at a loss.

So here's what I'm going to ask:

If you were setting up your Apache with a standard 11.10 LAMP install, what would be the steps you would take to get symlinks to work correctly for the Apache user?

share|improve this question
    
See also: stackoverflow.com/questions/7381371/… –  moose Mar 13 at 11:57

3 Answers 3

This sounds like a permissions issue. Make sure that each directory and parent directory that Apache must access (both in /var/www and in the symlinks' target directories) has the global execute bit set.

For example, if your symlinks point to /home/somebody/www, do this:

sudo chmod a+x /var /var/www /home /home/somebody /home/somebody/www

It is not necessary to set read access on any directory; only the files that Apache is supposed to read must have appropriate read permissions.

share|improve this answer

I would look at the permissions with my pathlld script (http://paste.ubuntu.com/757530/):

An example of pathlld:

walt@aardvark:~(0)$ ll $(type -p emacsclient)  
lrwxrwxrwx 1 root root 29 2011-10-23 11:20 /usr/bin/emacsclient -> /etc/alternatives/emacsclient  
walt@aardvark:~(0)$ pathlld $(type -p emacsclient)   
drwxr-xr-x 27 root root 4096 2011-12-02 04:07 /  
drwxr-xr-x 12 root root 4096 2011-10-23 19:29 /usr  
drwxr-xr-x 2 root root 135168 2011-12-02 16:03 /usr/bin  
lrwxrwxrwx 1 root root 29 2011-10-23 11:20 /usr/bin/emacsclient -> /etc/alternatives/emacsclient  
-rwxr-xr-x 1 root root 23440 2011-08-14 12:41 /usr/bin/emacsclient  
drwxr-xr-x 27 root root 4096 2011-12-02 04:07 /  
drwxr-xr-x 234 root root 12288 2011-12-02 16:06 /etc  
drwxr-xr-x 2 root root 20480 2011-11-29 09:31 /etc/alternatives  
lrwxrwxrwx 1 root root 28 2011-10-23 11:20 /etc/alternatives/emacsclient -> /usr/bin/emacsclient.emacs23  
-rwxr-xr-x 1 root root 23440 2011-08-14 12:41 /etc/alternatives/emacsclient  
drwxr-xr-x 27 root root 4096 2011-12-02 04:07 /  
drwxr-xr-x 12 root root 4096 2011-10-23 19:29 /usr  
drwxr-xr-x 2 root root 135168 2011-12-02 16:03 /usr/bin  
-rwxr-xr-x 1 root root 23440 2011-08-14 12:41 /usr/bin/emacsclient.emacs23  
share|improve this answer

example:

$ mkdir /home/myuser/proyects/php/myproyect

$ cd /var/www/

$ sudo ln -s /home/myuser/proyects/php/myproyect .

now you need:

1) set apache as owner of your proyect

$ sudo chown myuser:www-data /home/myuser/proyects/php/myproyect -R

2) set +x permissions on each folder to your path

$ sudo chmod +x /home/myuser/proyects
$ sudo chmod +x /home/myuser/proyects/php
$ sudo chmod +x /home/myuser/proyects/php/myproyect

Now you can see your project on http://localhost.


if any problems try:

restart apache

$ sudo service apache2 restart

if the problem persists make apache user owner of the link

$ cd /var/www/
$ sudo chown myuser:www-data myproyect -R

if the problem persists add execution permissions on your home

$ sudo chmod +x /home/myuser/
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.