【问题标题】:Time-out 504 Gateway Time-out nginx in wordpress-php-fpm超时 504 网关超时 nginx 在 wordpress-php-fpm
【发布时间】:2021-05-27 01:58:52
【问题描述】:

我想在 Kubernetes 中设置 WordPress PHP-fpm,所以我已经设置了,但是目前我在使用 Nginx 代理时遇到了一些问题,所以当我尝试安装 woo-commerce 插件时,它会给出错误的

安装失败:504 Gateway Time-out 504 Gateway Time-out nginx padding to disable MSIE and Chrome friendly error page ->

我不知道代理出了什么问题我已经将 proxy_read_timeout 的最大值设置为 100。但它也不起作用。我尝试了这么多代理超时值,但都不起作用,所以这是我的 Nginx 代理配置

wordpress.conf

server {
    listen 80;
    server_name localhost;
 
    root /var/www/html;
    index index.php;
 
    #access_log /var/log/nginx/hakase-access.log;
    #error_log /var/log/nginx/hakase-error.log;
 
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
 
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass wordpress:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_cache phpcache;
        fastcgi_cache_valid 200 301 302 60m;
        fastcgi_cache_min_uses 1;
        fastcgi_cache_lock on;
        add_header X-FastCGI-Cache $upstream_cache_status;
        fastcgi_cache_use_stale error timeout updating invalid_header http_500 http_503;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}

nginx.conf

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;
    fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=phpcache:100m max_size=10g inactive=60m use_temp_path=off;
    fastcgi_cache_key "$scheme$request_method$host$request_uri";
    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

【问题讨论】:

  • 这是您的本地环境还是本地环境?这个问题是在你安装woo-commerce plugin之后出现的,在此之前,它工作正常吗?

标签: php wordpress docker nginx kubernetes


【解决方案1】:

为我工作的人

location ~ \.php$ {
    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;
    fastcgi_connect_timeout 300s;
    fastcgi_send_timeout 60;
    fastcgi_read_timeout 60;
}

你必须在单个 pod 中运行两个容器,你可以调试 WordPress 的 ingress 和 nginx 的日志以查看更多详细信息。

你可以使用这个 github 作为参考:https://github.com/harsh4870/Kubernetes-wordpress-php-fpm-nginx

另外,请查看博客以了解更多信息:https://medium.com/@harsh.manvar111/kubernetes-wordpress-php-fpm-nginx-73cb4f9aef02

【讨论】:

    猜你喜欢
    • 2019-01-20
    • 2017-12-28
    • 2014-08-19
    • 2016-11-28
    • 1970-01-01
    • 2011-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多