Reputation: 804
I am trying to setup wordpress with mysql on nginx using docker-compose. Below are the configurations:
nginx:
server {
server_name blog.site.com;
index index.php index.html index.htm;
root /srv/wordpress/data;
location / {
root /srv/wordpress/data;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location /sitemap {
rewrite ^/sitemap.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
}
location ~* \.(png|jpg|jpeg|gif|ico)$ {
expires 1y;
log_not_found off;
root /srv/wordpress/data;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~* \.(css|js|woff2|woff|ttf)$ {
expires 30d;
log_not_found off;
error_log /var/log/nginx/font_err.log;
root /srv/wordpress/data;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
error_log /tmp/php_nginx.log;
root /srv/wordpress/data;
try_files $uri $uri/ /index.php?q=$uri&$args;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
docker-compose:
services:
wpdb:
image: mysql:5.7
volumes:
- /srv/db/wp:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: xxxxxxxxxx
MYSQL_DATABASE: my_wp
MYSQL_USER: xxxx
MYSQL_PASSWORD: xxxxxxxxxx
wordpress:
depends_on:
- wpdb
image: wordpress:latest
ports:
- "9000:9000"
restart: always
volumes:
- ./data:/var/www/html
environment:
WORDPRESS_DB_HOST: wpdb://wpdb:3306
WORDPRESS_DB_USER: xxxx
WORDPRESS_DB_PASSWORD: xxxxxxxxxx
WORDPRESS_DB_NAME: my_wp
but i am getting this error:
2020/07/18 09:40:15 [error] 7302#7302: *1 upstream sent unsupported FastCGI protocol version: 72 while reading response header from upstream, client: 213.217.43.162, server: blog.site.com, request: "GET /wp-admin/install.php?step=2 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "blog.site.com"
i see Drupal Page returning 502 error page instead of 404 and Upstream sent unsupported protocol version and some other solution about ports but they can't help me to solving this error
here is my result of sudo lsof -i :9000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
docker-pr 2081 root 4u IPv6 98062308 0t0 TCP *:9000 (LISTEN)
Upvotes: 1
Views: 2618
Reputation: 26
I ran into the same error with the wordpress:latest
Docker image. Changing it to wordpress:5.1.1-fpm-alpine
fixed it for me.
If you need to debug more, a docker ps -a
and curl -L localhost:9000
is to check if the Wordpress container is actually running correctly. What is the output of those?
Also this DigitalOcean tutorial worked for me flawlessly: https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-docker-compose
Upvotes: 1