首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Nginx <site>重定向你太多次了

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

Stack Overflow用户
提问于 2017-03-10 14:00:02
回答 1查看 781关注 0票数 0

我得到了上面提到的错误,无法找出原因:

我试过解决办法:

代码语言:javascript
复制
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

但没有成功。我认为这是我的nginx配置的问题,还是wordpress的bug?!?

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

Nginx Config:

代码语言:javascript
复制
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;
     }   
}
EN

回答 1

Stack Overflow用户

发布于 2017-03-10 14:12:08

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

代码语言:javascript
复制
define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42720176

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档