M
M
Mikhail2016-03-04 13:22:39
PHP
Mikhail, 2016-03-04 13:22:39

Why doesn't the nginx+php-fpm page load completely?

Good afternoon, there is a page that quite often it began to be given incompletely.
That is, the page began to simply break off, but this is not for everyone, it happens it happens. At first, I sinned against the php code that an error occurs and it simply does not load, looked at the code, it tritely beats it.
Reloaded nginx
Here are the configs

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user maestra;
worker_processes  8;
worker_priority -5;
worker_rlimit_nofile 4096;
events {
use epoll;
worker_connections  4096;
}

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

http {
    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;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    client_body_buffer_size 16K;
    client_header_buffer_size 4k;
    client_max_body_size 32M;
    large_client_header_buffers 8 32k;
    client_body_timeout   60;
    client_header_timeout 60;
 keepalive_timeout     60;
    send_timeout          60;
    reset_timedout_connection on;
    server_tokens off;
    gzip  on;
    gzip_static on;
    gzip_min_length 1100;
    gzip_buffers 64 8k;
    gzip_comp_level 4;
    gzip_http_version 1.1;
    gzip_proxied any;
#    gzip_types text/plain application/xml application/x-javascript text/css;
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xm$
    limit_req_zone $binary_remote_addr zone=dynamic:10m  rate=2r/s;
    proxy_connect_timeout  60000s;
    proxy_send_timeout  60000s;
    proxy_read_timeout 60000s;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_send_timeout 60000s;
fastcgi_connect_timeout 300;
fastcgi_read_timeout 60000s;
    server_name_in_redirect off;


    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.

upstream www {
        server unix:/var/run/php-fpm-pools/www.sock;
#server 127.0.0.1:9000;
}
upstream maestra {
        server unix:/var/run/php-fpm-pools/maestra.sock;
#server 127.0.0.1:9000;
}

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

    server {
        listen       80 default_server;
        listen       [::]:80;
#       listen 87.118.107.23:443 ssl;
#       listen       [::]:443 ssl;
#       ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#       ssl_prefer_server_ciphers on;
#       ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
#       ssl_certificate         /etc/nginx/ssl/ssl.crt;
#       ssl_certificate_key     /etc/nginx/ssl/private.key;
#       ssl_session_cache      shared:SSL:10m;
#       ssl_session_timeout    10m;
        server_name  myadmin.maestra.ru _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        location ~ \.php$ {
        root           /usr/share/nginx/html;
        try_files $uri =404;
        #fastcgi_pass   127.0.0.1:9000;
        fastcgi_pass www;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
        }


        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}

server {
        listen       87.118.107.23:80;
        listen       [::]:80;
#listen 87.118.107.23:443 ssl;
#       listen       [::]:443 ssl;
#       ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#       ssl_prefer_server_ciphers on;
#       ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
#       ssl_certificate         /etc/nginx/ssl/ssl.srt;
#       ssl_certificate_key     /etc/nginx/ssl/private.key;
#       ssl_session_cache      shared:SSL:10m;
#       ssl_session_timeout    10m;

        server_name  admin.maestra.ru;
        root         /home/maestra/www/admin.maestra.ru;
        access_log /var/log/nginx/admin.maestra.ru_access.log;
        error_log  /var/log/nginx/admin.maestra.ru_error.log;
        index index.php;
        charset UTF-8;

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

        location / {
        }

        location ~ \.php$ {
        limit_req zone=dynamic burst=20;
        fastcgi_pass maestra;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
        }

}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mikhail, 2016-03-06
@mix_gorbachev

A strange moment, but it was all because of the notes.
Removed a huge number of notices from the code, everything began to work fine.
strange moment

P
Pavel Volintsev, 2016-03-05
@copist

nginx runs under one user and php-fpm under another.
Set them up so that they work under the same user, or include one of them in the group of another.
Check permissions on cache and data proxy
folders Grant read/write permissions to these folders for php-fpm and nginx

A
Alexander, 2016-03-05
@OxGroup

try sendfile on comment it out

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question