Basic Nginx + PHP-FPM Docker config
server { | |
listen 80; | |
index index.php index.html; | |
server_name localhost; | |
root /var/www/html; | |
error_log /var/log/nginx/error; | |
access_log /var/log/nginx/access; | |
location / { | |
# Try to serve file directly, fallback to index.php | |
try_files $uri /index.php$is_args$args; | |
} | |
location ~ ^/index\.php(/|$) { | |
fastcgi_pass wordpress_service:9000; | |
fastcgi_split_path_info ^(.+\.php)(/.*)$; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | |
fastcgi_param DOCUMENT_ROOT $realpath_root; | |
fastcgi_buffer_size 128k; | |
fastcgi_buffers 4 256k; | |
fastcgi_busy_buffers_size 256k; | |
internal; | |
} | |
location ~ \.php$ { | |
return 404; | |
} | |
} |
FROM nginx:1.19.4-alpine | |
COPY default.conf /etc/nginx/conf.d/ | |
WORKDIR /var/www/html |
FROM wordpress:php7.4-fpm-alpine | |
WORKDIR /var/www/html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment