I have just started using Docker and have issues configuring the containers to serve the web pages properly. The issue is the following:
nginx2 | 2018/03/17 19:01:19 [error] 8#8: *8 FastCGI sent in stderr: "Access to the script '/var/www/sites/public/res/styles.css' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 172.21.0.1, server: , request: "GET /res/styles.css HTTP/1.1", upstream: "fastcgi://172.21.0.3:9000", host: "localhost:8080", referrer: "http://localhost:8080/"
nginx2 | 172.21.0.1 - - [17/Mar/2018:19:01:19 +0000] "GET /res/styles.css HTTP/1.1" 403 25 "http://localhost:8080/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36" "-"
I have tried adding my own custom php-fpm.conf
file to the container with the modified security.limit_extensions
parameter as indicated here but this causes the following error
php2 | [17-Mar-2018 19:49:31] ERROR: [/usr/local/etc/php-fpm.conf:1] value is NULL for a ZEND_INI_PARSER_ENTRY
php2 | [17-Mar-2018 19:49:31] ERROR: failed to load configuration file '/usr/local/etc/php-fpm.conf'
php2 | [17-Mar-2018 19:49:31] ERROR: FPM initialization failed
php2 exited with code 78
I have also seen other users get around this issue by including cgi.fix_pathinfo=1
in php.ini
. However, this did not fix the original problem.
If it is helpful, I have included my nginx configuration here
server{
# listen 80 default_server;
index index.php index.html;
# server_name localhost;
root /var/www/sites/public;
location / {
# root /var/www/sites/public;
try_files $uri $uri/ /index.php;
}
location ~ /res/ {
fastcgi_intercept_errors on;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass php2:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ \.php$ {
#include fastcgi.conf;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php2:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
I have also tried modifying the www.conf
file as indicated here however there is no such /etc/php*
path.
Cheers!