5

I have a LAMP server (Ubuntu 12.10) setup on my development machine. It is a T60 modified with an SSD.

The server base is in /var/www. Apache has the following config:

DocumentRoot /var/www
<Directory />
  Options FollowSymLinks
  AllowOverride None
</Directory>
<Directory /var/www/>
  Options Indexes FollowSymLinks MultiViews SymLinksIfOwnerMatch
  AllowOverride all
  Order allow,deny
  allow from all
</Directory>

I'm currently developing a SilverStripe CMS featured site. The folder for the server is /var/www/sfk/. The framework and all cms relavant features are in their respective folders. The only folder that need to be modified would be the /var/www/sfk/mysite folder. Because of that I want to keep the mysite folder under my home directory and symlink it into the server folder. So here is what I've done:

ln -s ~/sfk/mysite/ /var/www/sfk/
sudo chgrp www-data /var/www/sfk/mysite -R

ls tells me the following:

/var/www/sfk (exerpt)

drwxr-xr-x  3 marvin www-data 4096 Nov 16 16:53 assets
drwxr-xr-x 12 marvin www-data 4096 Nov 16 16:53 cms
drwxr-xr-x 29 marvin www-data 4096 Nov 16 16:53 framework
-rw-r--r--  1 marvin www-data 2410 Nov 16 16:53 index.php
lrwxrwxrwx  1 marvin www-data   24 Nov 20 17:45 mysite -> /home/marvin/sfk/mysite/
-rw-rw-r--  1 marvin www-data  514 Nov 16 16:55 _ss_environment.php
drwxr-xr-x  4 marvin www-data 4096 Nov 16 16:53 themes

and

ls /var/www/sfk/mysite/

drwxrwxr-x 6 marvin www-data 4096 Nov 16 00:15 code
drwxrwxr-x 2 marvin www-data 4096 Nov 16 11:51 _config
-rwxrwxr-x 1 marvin www-data 2685 Nov 16 15:39 _config.php
drwxrwxr-x 2 marvin www-data 4096 Nov 16 00:15 css
drwxrwxr-x 2 marvin www-data 4096 Nov 16 00:15 images
drwxrwxr-x 2 marvin www-data 4096 Nov 16 00:15 javascript
drwxrwxr-x 5 marvin www-data 4096 Nov 16 00:15 templates

This is literally the same setup I have on my desktop machine. The problem I have is that the mysite/ folder is just not recognized. I'm thankful for every advice I get. I'm frustrated because I'm stuck with this issue for hours.

2 Answers 2

5

Are you sure the www-data account has the ability to traverse every single directory component of /home/marvin/sfk/mysite/? So www-data has to have access to home, marvin, sfk, and mysite. You probably need to have o+x on every component of that path. When a symlink is followed, the user following the symlink must have the ability to actually get to the destination folder/file.

If you don't want to grant www-data access to your folder, then you might want to look at a bind mount instead.

4
  • or just add www-data to the group marvin (gpasswd -a www-data marvin) Nov 20, 2012 at 18:42
  • @rbtux, I suppose you could, but then your web server can probably read anything stored in his home directory. I am not sure he wants that. Best to stick with minimal permissions if you can.
    – Zoredache
    Nov 20, 2012 at 18:44
  • as he said development server, I don't think it would be an issue. But of course this would grant more permissions than needed. Nov 20, 2012 at 18:45
  • Okay, I had no rights given to the folder /home/marvin. Thank you for your answer. Worked. @rbtux: I prefer minimal permissions, even though it is a developer machine.
    – Weishaupt
    Nov 21, 2012 at 17:06
1

What are the permissions on your home directory and the sub directories, as they need to be accessible to the Apache user e.g.

chmod 755 ~/ ~/sfk ~mysite
1
  • After a week of struggling, this was my issue. Thank you, your suggestion fixed it.
    – J86
    Oct 19, 2021 at 21:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .