チュートリアルに従ってPHP-FPMでNginxを実行しようとしています(http://geekyplatypus.com/dockerise-your-php-application-with-nginx-and-php7-fpm/)が、ドッカーで実行されている私のnginxはPHPを解釈しませんファイルを開き、「403」エラーを返します。
私の「site.conf」
server {
index index.php index.html;
server_name learn-wordpress.com;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /usr/share/nginx/html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
私の「docker-compose.yml」
version: "3"
services:
web:
image: nginx:latest
ports:
- "80:80"
container_name: 'wp'
volumes:
- "./:/usr/share/nginx/html"
- ./site.conf:/etc/nginx/conf.d/site.conf
php:
image: 'php:7.4-fpm'
volumes:
- "./:/var/www/html"
私の PHP アプリケーションは、何も変更せずに Wordpress です。