wordpress wp-admin nginx не конечный sla sh без перенаправления nginx - PullRequest
0 голосов
/ 07 августа 2020

У меня есть следующая конфигурация из моей nginx конфигурации для моего сайта Wordpress.

server {

    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    server_name localhost;
    root /var/www;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
        # Add trailing slash to */wp-admin requests.
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    }

    location ~ \.php$ {
        if ($request_method = 'OPTIONS') {
            add_header 'Access-Control-Allow-Origin' '*';
            add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
            add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-Socket-Id,X-CSRF-TOKEN,Authorization';
#
# Tell client that this pre-flight info is valid for 20 days
#
            add_header 'Access-Control-Max-Age' 1728000;
            add_header 'Content-Type' 'text/plain; charset=utf-8';
            add_header 'Content-Length' 0;
            return 204;
        }

        if ($request_method = 'POST') {
            add_header 'Access-Control-Allow-Origin' '*';
        }

        if ($request_method = 'GET') {
            add_header 'Access-Control-Allow-Origin' '*';
        }

        if ($request_method = 'PUT') {
            add_header 'Access-Control-Allow-Origin' '*';
        }

        if ($request_method = 'DELETE') {
            add_header 'Access-Control-Allow-Origin' '*';
        }

        try_files $uri /index.php =404;
        fastcgi_pass php-upstream;
        fastcgi_index index.php;
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fixes timeouts
        fastcgi_read_timeout 600;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }

    location ~ /debug\.log$ {
        deny all;
    }

    location /wp-content/uploads/ {
        proxy_pass https://s3-ap-northeast-1.amazonaws.com/project-storage/wp-content/uploads/;
        proxy_intercept_errors on;

        if ($request_uri ~* ".css$") {
            add_header Content-Type text/css;
        }
    }

    location /.well-known/acme-challenge/ {
        root /var/www/letsencrypt/;
        log_not_found off;
    }

}

map $http_user_agent $log_ua {
    ~ELB-HealthChecker 0;
    ~Amazon-Route53-Health-Check-Service 0;
    default 1;
}

С приведенной выше конфигурацией я могу получить доступ к https://site-domain.com/wp-admin/, но при попытке доступа к https://site-domain.com/wp-admin загрузчик браузера (вверху слева от chrome) продолжает вращаться.

На вкладке сети я получаю следующее:

enter image description here

I've also tried adding:

remove_filter('template_redirect', 'redirect_canonical'); in the functions.php file of the theme used as suggested by this поток и добавленный код в файл конфигурации:

# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;

Но ни одна тема не работает . Буду очень благодарен, если кто-нибудь сможет мне помочь.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...