nginx 和 php-fpm 502 错误

路径积分

我为这个问题寻找了许多解决方案。但是,他们都没有帮助我解决它。/var/log/nginx/error.log 中显示的错误如下:

2017/04/21 16:08:16 [error] 29233#0: *319 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: ..., server: ..., request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "..."

Nginx 配置如下:

server {

    listen 443;
    server_name ... ...;

    ssl on;
    ssl_certificate /etc/nginx/ssl/....cer;
    #ssl_client_certificate /etc/nginx/ssl/....cer;
    ssl_certificate_key /etc/nginx/ssl/....key;
    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2; 

    root /var/www/drupal7; ## <-- Your only path reference.

    # Enable compression, this will help if you have for instance advagg module
    # by serving Gzip versions of the files.
    gzip_static on;
    sendfile on;
    client_max_body_size 2048M;

    location = /favicon.ico {
            log_not_found off;
            access_log off;
    }

    location = /robots.txt {
            allow all;
            log_not_found off;
            access_log off;
    }

    # Very rarely should these ever be accessed outside of your lan
    location ~* \.(txt|log)$ {
            allow 127.0.0.1;
            deny all;
    }

    location ~ \..*/.*\.php$ {
            return 403;
    }

    # No no for private
    location ~ ^/sites/.*/private/ {
            return 403;
    }

    # Block access to "hidden" files and directories whose names begin with a
    # period. This includes directories used by version control systems such
    # as Subversion or Git to store control files.
    location ~ (^|/)\. {
            return 403;
    }
    location / {
            # This is cool because no php is touched for static content
            try_files $uri @rewrite;
            proxy_read_timeout 300;
    }

    location /adore-djatoka {
#            if($args ~* "/adore-djatoka/resolver?url_ver=.+&rft_id=.+&svc_id=.+") {
#                rewrite ^ http://...:8080/adore-djatoka/resolver?url_ver=$0&rft_id=$2&svc_id=$1 last;
#            }
#            rewrite    ^(.*)https(.*)$    $1http$2;
             proxy_pass http://...:8080/adore-djatoka;
#            proxy_redirect http://...:8080/adore-djatoka /adore-djatoka;
            #proxy_redirect off;
    }

    location @rewrite {
            # You have 2 options here
            # For D7 and above:
            # Clean URLs are handled in drupal_environment_initialize().
            rewrite ^ /index.php;
            # For Drupal 6 and bwlow:
            # Some modules enforce no slash (/) at the end of the URL
            # Else this rewrite block wouldn't be needed (GlobalRedirect)
            #rewrite ^/(.*)$ /index.php?q=$1;
    }

    # For Munin
    location /nginx_status {
            stub_status on;
            access_log off;
            allow 127.0.0.1;
            deny all;
    }

    location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            fastcgi_intercept_errors on;
            fastcgi_pass 127.0.0.1:9000;
            #fastcgi_pass php-fpm;
    }

    # Fighting with Styles? This little gem is amazing.
    # This is for D7 and D8
    location ~ ^/sites/.*/files/styles/ {
            try_files $uri @rewrite;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires max;
            log_not_found off;
    }

}

如果需要,我也可以发布 php-fpm 配置文件。

谢谢,

路径积分

增加fastcgi_read_timeout参数以600帮助我解决我的问题。现在,加载网站有点慢。但是,我至少可以预览和管理该站点。感谢您的回复@NullDev。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

php-fpm的Nginx错误

来自分类Dev

独角兽和Nginx的奇怪问题导致502错误

来自分类Dev

Nginx和php-fpm处理php脚本的404错误(不记录日志)

来自分类Dev

nginx虚拟主机:php5-fpm-sock错误

来自分类Dev

Nginx添加标头PHP FPM返回错误

来自分类Dev

Nginx,Unicorn和Rails = 502错误的网关

来自分类Dev

错误的请求(400)和502错误:Nginx,gunicorn,django

来自分类Dev

重新加载PHP-FPM时出现502错误的网关错误

来自分类Dev

Docker中的Nginx和php-fpm

来自分类Dev

502错误的网关:nginx,php5-fpm,175/209 connect()失败(111:连接被拒绝),同时连接到上游

来自分类Dev

使用Nginx,PHP-FPM和Docker的PHP文件出现403错误

来自分类Dev

PM2和Nginx:502错误网关

来自分类Dev

Nginx + php5-fpm = 404别名位置错误

来自分类Dev

Nginx和PHP-FPM 502网关错误

来自分类Dev

Nginx / PHP-FPM“访问被拒绝。” 错误

来自分类Dev

使用Selenium和Django的DigitalOcean(gunicorn / nginx)502错误网关

来自分类Dev

Nginx / PHP-FPM“访问被拒绝。” 错误

来自分类Dev

PHP-FPM-Nginx-phpMyAdmin-502错误网关

来自分类Dev

Nginx + PHP-FPM 502错误的网关,代码点火器日志说:最终输出发送到浏览器

来自分类Dev

502错误的网关nginx php7 fpm

来自分类Dev

Nginx回应502错误

来自分类Dev

nginx虚拟主机:php5-fpm-sock错误

来自分类Dev

错误的请求(400)和502错误:Nginx,gunicorn,django

来自分类Dev

502错误的网关-Nginx

来自分类Dev

使用Nginx,PHP-FPM和Docker的PHP文件出现403错误

来自分类Dev

PM2和Nginx:502错误网关

来自分类Dev

Nginx和PHP-FPM 502网关错误

来自分类Dev

用于 nginx 和 php-fpm 的 Docker

来自分类Dev

docker 上的 NginX 和 Php-Fpm

Related 相关文章

热门标签

归档