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

时间:2017-03-10 14:00:03

标签: wordpress nginx

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

我尝试了解决方案:

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

但没有成功。我认为这是我的nginx配置问题还是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;
     }   
}

1 个答案:

答案 0 :(得分:0)

您已将自己的网站定义为http,但已在https下实施。您应该设置正确的网站网址:

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