nginx:mywebsite.intweb.net重定向了您太多次。 ERR_TOO_MANY_REDIRECTS,

时间:2018-12-05 23:58:14

标签: wordpress nginx nginx-config

当我在浏览器中访问该URL时,我一直从nginx收到此错误,但是我不了解的部分是我的配置中没有任何重写。另外,我在nginx的错误日志中没有得到任何相关信息。我在下面共享我的配置:

# Force HTTP requests to HTTPS
    server {
        listen 80;
        server_name mywebsite.intweb.net;
        return 301 https://mywebsite.intweb.net$request_uri;
    }
      server {

      listen  443 ssl;
      root  /var/opt/httpd/lbdocs;

    server_name mywebsite.intweb.net ;

      # add Strict-Transport-Security to prevent man in the middle attacks
    add_header Strict-Transport-Security "max-age=31536000" always;
    ssl_certificate     /etc/pki/tls/certs/star_intweb_net.pem;
    ssl_certificate_key /etc/pki/tls/certs/star_intweb_net.key;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

      access_log /var/log/nginx/lblogs/https/access.log;
    error_log  /var/log/nginx/lblogs/https/error.log;

   # include rewrites/mywebsite.com.conf;


    index  index.php index.html index.htm;

    # Make nginx serve static files instead of Apache
    # NOTE this will cause issues with bandwidth accounting as files wont be logged
    location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|htm|html|js|css)$ {
        expires max;
    }

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8080;
         }

    # proxy the PHP scripts to Apache listening on <serverIP>:8080
    location ~ \.php$ {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8080;
         }

    location ~ /\. {
        deny  all;
    }

谢谢

2 个答案:

答案 0 :(得分:0)

website能够解决我的问题:

我们经常遇到的最常见的错误配置是,当用户在WordPress地址URL或站点地址URL设置中使用不正确的URL时。

enter image description here

例如,假设您的网站网址为http://www.example.com,然后转到“设置”»“常规”并将其设置为http://example.com。大多数网络托管服务商允许您选择是要在域名中添加www前缀还是让其不包含www。如果您选择将www添加到您的URL中,然后在WordPress设置中添加http://example.com将会导致错误。或者,如果您选择使用不带www前缀的域名,那么在WordPress设置中添加带有www前缀的域名将导致此错误。

如果仍然不能解决问题,则必须进行搜索并替换WP正在使用的数据库。

答案 1 :(得分:0)

问题与WordPress有关。我必须根据我的nginx配置所指向的内容将wordpress wp-config.php文件编辑为https或常规http,因为否则nginx和wordpress会一直相互重定向,然后会发生此错误。