Nginx 的 fastcgi 问题 7.2

Nginx 的 fastcgi 问题 7.2

你好,我的日志里充满了错误;(有时页面需要很长时间才能加载

2019/02/01 14:06:23 [info] 880#880: *3090 epoll_wait() 报告客户端在向上游发送请求时过早关闭连接,客户端:142.93.203.222,服务器:pitamyshawarma.com,请求:“GET /templates/shaper_cuisine/css/bootstrap-legacy/accordion.less HTTP/1.1”,上游:“fastcgi://unix:/var/run/php/php7.2-fpm.sock:”,主机:“pitamyshawarma.com” 2019/02/01 14:06:24 [info] 880#880: *3092 客户端 142.93.203.222 关闭了保持连接 2019/02/01 14:06:24 [错误] 880#880:*3042 FastCGI 在 stderr 中发送:“PHP 消息:PHP 通知:未定义偏移量:1 在 /var/www/pitamyshawarma.com/html/templates/shaper_cuisine/sppagebuilder/addons/cuisine_menu/site.php 上线 56”,同时从上游读取响应标头,客户端:74.109.198.57,服务器:pitamyshawarma.com,请求:“GET /menu HTTP/2.0”,上游:“fastcgi://unix:/var/run/php/php7.2-fpm.sock:”,主机:“pitamyshawarma.com”,引用者:“https://pitamyshawarma.com/find-us

settings in nginx

server {
        server_name pitamyshawarma.com www.pitamyshawarma.com
        server_name_in_redirect off;

        access_log /var/log/nginx/localhost.access_log;
        error_log /var/log/nginx/localhost.error_log info;

        root /var/www/pitamyshawarma.com/html;
        index index.php index.html index.htm default.html default.htm;
        # Support Clean (aka Search Engine Friendly) URLs
        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        # deny running scripts inside writable directories
        location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
                return 403;
                error_page 403 /403_error.html;
        }

        location ~ \.php$ {
        fastcgi_cache phpcache; # The name of the cache key-zone to use
        fastcgi_cache_valid 200 30m; # What to cache: 'Code 200' responses, for half an hour
        fastcgi_cache_methods GET HEAD; # What to cache: only GET and HEAD requests (not POST)
        fastcgi_read_timeout 864000;
        add_header X-Fastcgi-Cache $upstream_cache_status; # Add header so we can see if the cache hits or misses


         include snippets/fastcgi-php.conf;

        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;


        }


        # caching of files 
        location ~* \.(ico|pdf|flv)$ {
                expires 1y;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
                expires 14d;
        }


    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/pitamyshawarma.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/pitamyshawarma.com/privkey.pem; # managed by Certbot
    #include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

    #ssl_ciphers **********;

    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    ssl_session_cache shared:SSL:20m; # holds approx 4000 sessions
    ssl_session_timeout 2h; # 1 hour during which sessions can be re-used.
    ssl_session_tickets off;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

}

server {
    if ($host = www.pitamyshawarma.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = pitamyshawarma.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80;
        server_name pitamyshawarma.com www.pitamyshawarma.com
        server_name_in_redirect off;
    return 404; # managed by Certbot




}

相关内容