Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Apache doesn't follow symbolic links

  1. #1
    Join Date
    May 2013
    Beans
    154
    Distro
    Ubuntu

    Apache doesn't follow symbolic links

    Apache doesn't follow symbolic links for some unknown reason although I configured it to accept them as following:

    Code:
    mbnoimi-laptop Projects # ls -l
    total 4
    drwxrwxr-x 2 www-data www-data 4096 كانون 15 14:31 MyBlog
    mbnoimi-laptop Projects # cd MyBlog/
    mbnoimi-laptop MyBlog # ls -l
    total 20
    -rwxrwxr-x 1 www-data www-data 11510 كانون 10 07:09 index.html
    mbnoimi-laptop MyBlog # nano .htaccess
    mbnoimi-laptop MyBlog # cat .htaccess 
    Option Indexes
    mbnoimi-laptop MyBlog # cd ..
    mbnoimi-laptop Projects # ln -s '/home/mbnoimi/Desktop/Projects/MyBlog' /var/www/html/
    mbnoimi-laptop Projects # ls -l /var/www/html/
    total 12
    -rwxrwxr-x 1 mbnoimi www-data 11510 كانون 10 07:09 index_.html
    lrwxrwxrwx 1 root    root        37 كانون 15 14:48 MyBlog -> /home/mbnoimi/Desktop/Projects/MyBlog
    mbnoimi-laptop Projects # chown -R www-data:www-data /var/www/html/MyBlog
    mbnoimi-laptop Projects # ls -l /var/www/html/
    total 12
    -rwxrwxr-x 1 mbnoimi  www-data 11510 كانون 10 07:09 index_.html
    lrwxrwxrwx 1 www-data www-data    37 كانون 15 14:48 MyBlog -> /home/mbnoimi/Desktop/Projects/MyBlog
    mbnoimi-laptop Projects #
    When I browse http://localhost/MyBlog I get:
    Code:
    Forbidden
    
    You don't have permission to access /MyBlog on this server.
    Apache/2.4.7 (Ubuntu) Server at localhost Port 80
    /etc/apache2/sites-enabled/000-default.conf
    Code:
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www/html
            <Directory />
                    Options FollowSymLinks Indexes
                    AllowOverride None
            </Directory>
            <Directory /var/www/html/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>
    
            ErrorLog ${APACHE_LOG_DIR}/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    
        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
    
    </VirtualHost>
    My I get some help please?
    Last edited by mbnoimi; January 15th, 2015 at 01:55 PM. Reason: Add some details

  2. #2
    Join Date
    May 2013
    Beans
    154
    Distro
    Ubuntu

    Re: Apache doesn't follow symbolic links

    BTW, I read this post but unfortunately it didn't help me to fix this issue

  3. #3
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: Apache doesn't follow symbolic links

    What does /var/log/apache2/error.log report?

    You could use an alias instead of a symlink like this:
    Code:
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www/html
    
            Alias /MyBlog /home/mbnoimi/Desktop/Projects/MyBlog
            <Directory "/home/mbnoimi/Desktop/Projects/MyBlog">
            [stuff]
            </Directory>
      
            <Directory />
                    Options FollowSymLinks Indexes
                    AllowOverride None
            </Directory>
            <Directory /var/www/html/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    Also that .htaccess is being ignored since you have "AllowOverride None" set.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  4. #4
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    3,521
    Distro
    Ubuntu Development Release

    Re: Apache doesn't follow symbolic links

    I wonder if the problem (or one of the problems) might be with permissions of parent directories. For example:

    I set up this:
    Code:
    doug@s15:/home$ ls -l /var/www/html
    total 28
    lrwxrwxrwx 1 doug doug   14 Jan 16 11:35 bla -> /home/doug/bla
    ... deleted the rest...
    Which worked fine with this:
    Code:
    doug@s15:/home$ ls -l
    total 8
    drwxr-xr-x 79 doug    doug    4096 Jan 16 11:34 doug
    but didn't work with this:
    Code:
    doug@s15:/home$ chmod 700 doug
    doug@s15:/home$ ls -l
    total 8
    drwx------ 79 doug    doug    4096 Jan 16 11:34 doug
    giving this:
    Code:
    doug@s15:/home$ tail -1 /var/log/apache2/error.log
    [Fri Jan 16 11:38:06.247259 2015] [core:error] [pid 23809] [client 192.168.111.101:60360] AH00037: Symbolic link not allowed or link target not accessible: /var/www/html/bla
    and this:
    Code:
    Forbidden
    
    You don't have permission to access /bla/index.html on this server.
    Apache/2.4.7 (Ubuntu) Server at s15.smythies.com Port 80
    Last edited by Doug S; January 16th, 2015 at 08:49 PM.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  5. #5
    Join Date
    May 2013
    Beans
    154
    Distro
    Ubuntu

    Re: Apache doesn't follow symbolic links

    What does /var/log/apache2/error.log report?
    I got:
    Code:
    [Fri Jan 16 22:03:53.004502 2015] [core:error] [pid 1983:tid 139872387987200] [client 127.0.0.1:44349] AH00037: Symbolic link not allowed or link target not accessible: /var/www/html/MyBlog
    You could use an alias instead of a symlink like this:
    I don't want to use ALIAS because it's not a practical solution for daily programming. I want to use symlinks because it's very easy to create a link to development project on outside apache data folder.

  6. #6
    Join Date
    May 2013
    Beans
    154
    Distro
    Ubuntu

    Re: Apache doesn't follow symbolic links

    I wonder if the problem (or one of the problems) might be with permissions of parent directories. For example:
    I doubt that because I set the permission to the parent folder as mentioned before like that:
    Code:
    mbnoimi-laptop Projects # ls -l
    total 4
    drwxrwxr-x 2 www-data www-data 4096 كانون 15 14:31 MyBlog

  7. #7
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    3,521
    Distro
    Ubuntu Development Release

    Re: Apache doesn't follow symbolic links

    Quote Originally Posted by mbnoimi View Post
    I doubt that because I set the permission to the parent folder as mentioned before like that:
    Code:
    mbnoimi-laptop Projects # ls -l
    total 4
    drwxrwxr-x 2 www-data www-data 4096 كانون 15 14:31 MyBlog
    I meant the parent(s) of the symlink destination not its source, as per my very detailed example.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  8. #8
    Join Date
    May 2013
    Beans
    154
    Distro
    Ubuntu

    Re: Apache doesn't follow symbolic links

    Code:
    mbnoimi@mbnoimi-laptop ~/Desktop/Projects $ ls -l .
    total 4
    drwxrwxr-x 2 www-data www-data 4096 Jan 15 14:41 MyBlog
    mbnoimi@mbnoimi-laptop ~/Desktop/Projects $ cd ..
    mbnoimi@mbnoimi-laptop ~/Desktop $ ls -l .
    total 40
    -rw-r--r-- 1 mbnoimi  mbnoimi    147 Jan  3 23:45 1sec.txt
    -rw-r--r-- 1 mbnoimi  mbnoimi  16291 Jan  5 07:12 jun.odt
    drwxrwxr-x 3 www-data www-data  4096 Jan 15 14:33 Projects
    mbnoimi@mbnoimi-laptop ~/Desktop $

  9. #9
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    3,521
    Distro
    Ubuntu Development Release

    Re: Apache doesn't follow symbolic links

    Keep going.
    You need to also look at permissions for /home/mbnoimi and /home.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  10. #10
    Join Date
    May 2013
    Beans
    154
    Distro
    Ubuntu

    Re: Apache doesn't follow symbolic links

    Come on! Do I've to set a permission for all my home director to 775 and own by www-data for accepting it in apache?!

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •