Nginx Wordpress - <site> 重定向你太多次



我正在收到上述错误,无法查明原因:

我尝试了解决方案:

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

但没有成功。我认为我的nginx configuraton或WordPress的错误是一个问题?!?

我在sites-enable中还有其他配置,我尝试删除所有配置,并重新加载nginx而没有任何成功。

nginx配置:

server {
    listen 80; 
    # Make site accessible from http://localhost/
    server_name <site name>;
    return 301 https://$host$request_uri;
}
server {
    listen 443 http2;
    server_name <site name>;
    ssl on; 
    ssl_certificate /etc/ssl/private/server.crt;
    ssl_certificate_key /etc/ssl/private/server.key;
    # side note: only use TLS since SSLv2 and SSLv3 have had recent vulnerabilities
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    root /gctl_wp/;
    index index.html index.htm index.php;
    server_name <site name>;
     location / { 
        try_files $uri $uri/ /index.php?$args;
     }   
    location ~ .php$ {
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass unix:/var/run/php7-fpm.sock;
        fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_index index.php;
        include fastcgi_params;
     }   
}

您已将网站定义为http,但在https下实现了。您应该设置正确的网站URL:

define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');

最新更新