Нормальный сайт WordPress работает нормально, сопоставленный домен дает 502 recv () не удалось (104: сброс соединения по пиру) - PullRequest
0 голосов
/ 13 марта 2019

У меня есть сеть WordPress, которая представляет собой 1 обычный сайт и веб-сайт, на котором 3 языка представлены доменами (с помощью polylang)

domain.com

domain1.org является английским domain2.com испанский domain3.com - португальский все на одной установке WordPress, которые работают на моем VPS

domain.com и domain1.com хорошо загружаются

я добавил сопоставление доменов на домен2 и домен3 но они получают ошибку 502 и это журнал * 6 recv () завершился ошибкой (104: сброс соединения по одноранговому узлу) при чтении заголовка ответа из восходящего потока, клиент: 138.xx.xx.201, сервер: domain2.com, запрос: «GET / HTTP / 1.1», восходящий поток: « fastcgi: // unix: /home/Alandivar/run/php71-fpm.sock: ", хост:" domain2.com "

что я могу сделать, чтобы это работало ??

NGINX CONF:

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

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections  1024;
}


http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;

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

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

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

    gzip on;
    gzip_disable "msie6";
    gzip_min_length  1100;
    gzip_buffers  4 32k;
    gzip_types    text/plain application/x-javascript text/xml text/css;

    open_file_cache          max=10000 inactive=10m;
    open_file_cache_valid    2m;
    open_file_cache_min_uses 1;
    open_file_cache_errors   on;

    ignore_invalid_headers on;
    client_max_body_size    8m;
    client_header_timeout  3m;
    client_body_timeout 3m;
    send_timeout     3m;
    connection_pool_size  256;
    client_header_buffer_size 4k;
    large_client_header_buffers 4 4k;
    request_pool_size  4k;
    output_buffers   4 32k;
    postpone_output  1460;
    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;

    # 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.
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

САЙТ В НАЛИЧИИ КОНФ:

server {
        listen 80;
        server_name domain.com www.domain.com;
        return  301 https://finelandvitamins.com$request_uri;
}
server {
        listen       443;
        server_name domain.com www.domain.com;       
    root         /var/www/html/wordpress;
    index index.php index.html index.htm;

        ssl on;
        ssl_certificate /etc/letsencrypt/live/domain.com-0001/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/domain.com-0001/privkey.pem; # managed by Certbot

        # START: Solution
        location / {
                try_files $uri $uri/ /index.php?$args;
        }
        # END: Solution

        location ~ /\. {
                deny all;
        }

        location ~* /(?:uploads|files)/.*\.php$ {
                deny all;
        }

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

        location ~* \.(js|css|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
                expires max;
                log_not_found off;
        }

        location ~* \.()$ {
               log_not_found off;
               expires max;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/home/Alandivar/run/php71-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

server {
        listen 80;
        server_name domain1.org www.domain1.org
        return  301 https://domain1.org$request_uri;
}
server {
        listen       443;
        server_name domain1.org www.domain1.org;       
    root         /var/www/html/wordpress;
    index index.php index.html index.htm;

        ssl on;
        ssl_certificate /etc/letsencrypt/live/domain3.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/domain3.com/privkey.pem; # managed by Certbot

        # START: Solution
        location / {
                try_files $uri $uri/ /index.php?$args;
        }
        # END: Solution

        location ~ /\. {
                deny all;
        }

        location ~* /(?:uploads|files)/.*\.php$ {
                deny all;
        }

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

        location ~* \.(js|css|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
                expires max;
                log_not_found off;
        }

        location ~* \.()$ {
               log_not_found off;
               expires max;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/home/Alandivar/run/php71-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
                fastcgi_param HTTPS on;
        }
}

server {
        listen 80;
        server_name domain3.com www.domain3.com;
        return  301 https://domain3.com$request_uri;
}
server {
        listen       443;
        server_name domain3.com www.domain3.com;       
    root         /var/www/html/wordpress;
    index index.php index.html index.htm;

        ssl on;
        ssl_certificate /etc/letsencrypt/live/domain3.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/domain3.com/privkey.pem; # managed by Certbot

        # START: Solution
        location / {
                try_files $uri $uri/ /index.php?$args;
        }
        # END: Solution

        location ~ /\. {
                deny all;
        }

        location ~* /(?:uploads|files)/.*\.php$ {
                deny all;
        }

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

        location ~* \.(js|css|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
                expires max;
                log_not_found off;
        }

        location ~* \.()$ {
               log_not_found off;
               expires max;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/home/Alandivar/run/php71-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
                fastcgi_buffer_size 128k;
                fastcgi_buffers 256 4k;
                fastcgi_busy_buffers_size 256k;
        }
}


server {
        listen 80;
        server_name domain3.com www.domain3.com;
        return  301 https://domain3.com$request_uri;
}
server {
        listen       443;
        server_name domain3.com www.domain3.com;       
    root         /var/www/html/wordpress;
    index index.php index.html index.htm;

        ssl on;
        ssl_certificate /etc/letsencrypt/live/domain3.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/domain3.com/privkey.pem; # managed by Certbot

        # START: Solution
        location / {
                try_files $uri $uri/ /index.php?$args;
        }
        # END: Solution

        location ~ /\. {
                deny all;
        }

        location ~* /(?:uploads|files)/.*\.php$ {
                deny all;
        }

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

        location ~* \.(js|css|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
                expires max;
                log_not_found off;
        }

        location ~* \.()$ {
               log_not_found off;
               expires max;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/home/Alandivar/run/php71-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

Странно то, что curl -I domain2.com говорит, что все в порядке, но браузер продолжает выдавать ошибку.

root @ drl [~] # curl -I domain2.com HTTP / 1.1 301 перемещено навсегда Сервер: nginx / 1.10.2 Дата: ср., 13 марта 2019 г. 20:08:54 мск Тип контента: текст / HTML Длина контента: 185 Подключение: keep-alive Расположение: https://domain2.com/

я перезагружаю fpm и пытаюсь загрузить сайт, и журнал ошибок fpm выходит вот так

[13-Mar-2019 16:50:11] NOTICE: fpm is running, pid 27697
[13-Mar-2019 16:50:11] NOTICE: ready to handle connections
[13-Mar-2019 16:50:24] WARNING: [pool Alandivar] child 27923 exited on signal 9 (SIGKILL) after 5.299092 seconds from start
[13-Mar-2019 16:50:27] NOTICE: [pool Alandivar] child 27925 started
...