问题:Cloudflare 错误 502 网关错误 - Nginx - Laravel5

最近,只要我登录到我的网站到仪表板,我就一直看到这个屏幕

我该如何防止这种情况?

我在我的 Nginx 上使用 CloudFlare。

我曾经使用过 Fail2Ban,但我禁用了它。

[nginx-req-limit]

enabled   = false
filter    = nginx-req-limit
action    = iptables-multiport[name=ReqLimit, port="http,https", protocol=tcp]
        jdoeddos
logpath   = /var/log/nginx/default-error.log
findtime  = 10
bantime   = 7200
maxretry  = 20

Nginx

#limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;

server {
    listen 80 default_server;
    server_name jdoe.com www.jdoe.com;
    root /home/forge/jdoe/public;



    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    index index.html index.htm index.php;

    charset utf-8;

    
    

    location / {
        #limit_req zone=one burst=2 nodelay;
        try_files $uri $uri/ /index.php?$query_string;
        add_header 'Access-Control-Allow-Origin' '*';
    }

    location ~ \.php$ {
        #limit_req zone=one burst=2 nodelay;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

  

    access_log off;
    error_log  /var/log/nginx/default-error.log error;

    error_page 404 /index.php;



    location ~ /\.ht {
        deny all;
    }

}

有什么我需要关闭的设置吗?

解答

改变这个

location ~ \.php$ {
        #limit_req zone=one burst=2 nodelay;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include /etc/nginx/fastcgi_params;
        }
Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐