nginx:mywebsite.intweb.net 重定向您的次数太多。 ERR_TOO_MANY_REDIRECTS,
nginx: mywebsite.intweb.net redirected you too many times. ERR_TOO_MANY_REDIRECTS,
当我在浏览器中点击 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;
}
谢谢
这个 website 能够解决我的问题:
我们反复遇到的最常见的错误配置是用户在 WordPress 地址 URL 或站点地址 URL 设置中的 URL 不正确。
例如,假设您网站的 url 在您的 WordPress 设置中是 http://www.example.com and you go to Settings » General and set it to http://example.com. Most web hosts allow you to choose whether you would like to add a www prefix to your domain name or have it without www. In case you had selected to add www to your URL, then adding http://example.com 将导致错误。或者,如果您选择使用不带 www 前缀的域,那么在 WordPress 设置中添加带有 www 前缀的域将导致此错误。
如果仍然不能解决问题,您将不得不在 WP 使用的数据库中进行搜索和替换。
问题与 WordPress 有关。我必须根据我的 nginx 配置指向的内容将 wordpress wp-config.php 文件编辑为 https 或常规 http,否则 nginx 和 wordpress 会不断相互重定向,然后会发生此错误。
当我在浏览器中点击 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;
}
谢谢
这个 website 能够解决我的问题:
我们反复遇到的最常见的错误配置是用户在 WordPress 地址 URL 或站点地址 URL 设置中的 URL 不正确。
例如,假设您网站的 url 在您的 WordPress 设置中是 http://www.example.com and you go to Settings » General and set it to http://example.com. Most web hosts allow you to choose whether you would like to add a www prefix to your domain name or have it without www. In case you had selected to add www to your URL, then adding http://example.com 将导致错误。或者,如果您选择使用不带 www 前缀的域,那么在 WordPress 设置中添加带有 www 前缀的域将导致此错误。
如果仍然不能解决问题,您将不得不在 WP 使用的数据库中进行搜索和替换。
问题与 WordPress 有关。我必须根据我的 nginx 配置指向的内容将 wordpress wp-config.php 文件编辑为 https 或常规 http,否则 nginx 和 wordpress 会不断相互重定向,然后会发生此错误。