2

I use a Docker image: https://github.com/docker-library/php/blob/fec7f537f049aafd2102202519c3ca9cb9576707/5.5/apache/Dockerfile

And i use it with docker-compose:

apache: build: ./site/docker/apachephp environment: - VIRTUAL_HOST=www.test.dev volumes: - ./site/code:/var/www/app expose: - "80" 

The code is a symfony app and uses symbolic link in the web folder, but for all assets in the symbolic links i get in the apache logs:

AH00037: Symbolic link not allowed or link target not accessible: /var/www/app/web/test

All other code runs fine.
I wonder if that Options +FollowSymLinks -SymLinksIfOwnerMatch is used correct and if there maybe other config files that override someting?

Or is it some Permission issue? The files on the host belong not to the apache user www-data but to another user, read rights are set however.

The Apache config is:

# see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf Mutex file:/var/lock/apache2 default PidFile /var/run/apache2/apache2.pid Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 5 User www-data Group www-data HostnameLookups Off ErrorLog /proc/self/fd/2 LogLevel warn IncludeOptional mods-enabled/*.load IncludeOptional mods-enabled/*.conf # ports.conf Listen 80 <IfModule ssl_module> Listen 443 </IfModule> <IfModule mod_gnutls.c> Listen 443 </IfModule> <Directory /> AllowOverride None Require all denied </Directory> <Directory /var/www/app> Options +FollowSymLinks -SymLinksIfOwnerMatch AllowOverride All Require all granted </Directory> DocumentRoot /var/www/app/web AccessFileName .htaccess <FilesMatch "^\.ht"> Require all denied </FilesMatch> LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %O" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent CustomLog /proc/self/fd/1 combined <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> # Multiple DirectoryIndex directives within the same context will add # to the list of resources to look for rather than replace # https://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex DirectoryIndex disabled DirectoryIndex app_dev.php index.php index.html IncludeOptional conf-enabled/*.conf IncludeOptional sites-enabled/*.conf 
3
  • 2
    Have you entered the running container and checked the configuration which is used inside the container. Sometimes it is a bit confusing where to place a config or how to reference it correctly. My best practice when I got trouble like this is, runn the container go in it with docker exec -i -t containername /bin/bash and have a look whats going on in there. Commented Oct 27, 2015 at 15:22
  • I would use docker exec -ti <container name> to inspect the path inside the container and see what's there and where the links are set. You can get the container name from docker ps. Commented Oct 27, 2015 at 19:52
  • good idea guys, ill try tomorrow Commented Oct 29, 2015 at 17:08

2 Answers 2

1

To answer my own question: thanks to the tips in the comments above, i logged in the container and checked the pathes and the symlinks were pathes of the host, so that couldnt work.

So i probably have to create the symlinks in the container, unless there is some way to tell docker to follow symlinks from the host, but i doubt that.

Sign up to request clarification or add additional context in comments.

Comments

1

I also had a problem with symbolic links, and in my case it was because the link was with a physical path from the root of the system, and Docker somehow virtualizes the paths of the instance. As follows:

analyticsSync -> /media/user/DATA/dev/web/ic/analytics/public/sync/analyticsSync

I solved it by creating the relative symbolic link:

analyticsSync -> ic/analytics/public/sync/analyticsSync

"/media/user/DATA" is the physical path of my data partition, which is not recognized by Docker.

I hope it helps.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.