wordpress - 上游发送不支持的 FastCGI 协议版本
问题描述
我正在尝试使用 docker-compose 在 nginx 上使用 mysql 设置 wordpress。以下是配置:
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;
}
}
码头工人撰写:
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
但我收到此错误:
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"
我看到Drupal 页面返回 502 错误页面而不是 404并且上游发送了不受支持的协议版本和一些其他关于端口的解决方案,但他们无法帮助我解决这个错误
这是我的结果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)
解决方案
wordpress:latest
我在使用Docker 映像时遇到了同样的错误。更改它wordpress:5.1.1-fpm-alpine
为我修复它。
如果您需要进行更多调试,adocker ps -a
和curl -L localhost:9000
是检查 Wordpress 容器是否实际运行正确。这些的输出是什么?
这个 DigitalOcean 教程也完美地为我工作:https ://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-docker-compose
推荐阅读
- exchange-server - 如何在 EWS API 中关闭特定邮箱的流订阅?
- ios - 为什么日期格式化程序崩溃?
- rest - 问题 AVR 卡住并且程序计数器丢失...?
- ipfs - IPFS 上是否可以进行临时、非持久存储?
- php - Prestashop 在管理面板侧边栏菜单中添加新项目
- php - 谷歌分析 API 错误的用户编号和维度
- python - Pandas 深拷贝和 scikit 学习 min max scaler
- python - 我可以缩短在 Python 中添加多个变量的过程吗?
- python - 正则表达式查找开始和结束之间的所有行
- node.js - Shopify Script Tags Create 方法未在控制台中显示响应