【问题标题】:Nginx Wordpress - <site> redirected you too many timesNginx Wordpress - <site> 重定向你太多次
【发布时间】:2017-03-10 14:00:02
【问题描述】:

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

我尝试了解决方案:

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;
     }   
}

【问题讨论】:

    标签: wordpress nginx


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2019-05-07
      • 2020-10-21
      • 2016-10-20
      • 1970-01-01
      • 2019-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多