gpt4 book ai didi

ruby-on-rails - "Request exceeded the limit of 10 internal redirects due to probable configuration error"同时将 WordPress 置于反向代理之后

转载 作者:行者123 更新时间:2023-12-03 17:22:17 34 4
gpt4 key购买 nike

我已经阅读了许多问题/答案和博客文章,但没有一个对我有用。为了给你一些背景,我想做的是:

  • 让我在 example.com 上的 Rails 应用程序在 Heroku 上运行
  • 在 example.com/blog 上让 Wordpress 在 DigitalOcean 上运行

  • 我尝试了很多不同的事情,但最终我无法解决当我尝试访问博客文章时出现的这个错误(访问博客主页或管理员工作正常):
    [Tue Mar 30 21:46:24.047355 2021] [ssl:info] [pid 818] [client 54.89.204.173:53088] AH01964: Connection to child 2 established (server blog.example.com:443)
    [Tue Mar 30 21:46:24.047582 2021] [ssl:debug] [pid 818] ssl_engine_kernel.c(2372): [client 54.89.204.173:53088] AH02043: SSL virtual host for servername blog.example.com found
    [Tue Mar 30 21:46:24.057128 2021] [ssl:debug] [pid 818] ssl_engine_kernel.c(2254): [client 54.89.204.173:53088] AH02041: Protocol: TLSv1.3, Cipher: TLS_AES_256_GCM_SHA384 (256/256 bits)
    [Tue Mar 30 21:46:24.057482 2021] [ssl:debug] [pid 818] ssl_engine_kernel.c(415): [client 54.89.204.173:53088] AH02034: Initial (No.1) HTTPS request received for child 2 (server blog.example.com:443), referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057636 2021] [authz_core:debug] [pid 818] mod_authz_core.c(817): [client 54.89.204.173:53088] AH01626: authorization result of Require all granted: granted, referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057645 2021] [authz_core:debug] [pid 818] mod_authz_core.c(817): [client 54.89.204.173:53088] AH01626: authorization result of <RequireAny>: granted, referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057879 2021] [core:error] [pid 818] [client 54.89.204.173:53088] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057885 2021] [core:debug] [pid 818] core.c(3832): [client 54.89.204.173:53088] AH00121: r->uri = /blog/index.php, referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057888 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057891 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057894 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057896 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057899 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057902 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057904 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057907 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057911 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.057917 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /hello-world/, referer: https://example.com/blog/
    [Tue Mar 30 21:46:24.058076 2021] [ssl:debug] [pid 818] ssl_engine_io.c(1102): [client 54.89.204.173:53088] AH02001: Connection closed to child 2 with standard shutdown (server blog.example.com:443)
    这是我正在使用的内容及其设置
    我在 rails 应用程序上使用了 rack-reverse-proxy gem:
    config.middleware.insert(0, Rack::ReverseProxy) do
    reverse_proxy_options preserve_host: true
    reverse_proxy /^\/blog(\/.*)$/, 'https://example.com$1'
    end
    在 WordPress 常规设置中,我在 WordPress 地址和站点地址字段上都有“https://example.com/blog”。
    我的 .htaccess 是由 WordPress 创建的:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /blog/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]
    </IfModule>
    虚拟主机在 /etc/apache2/sites-enabled/000-default.conf :
    UseCanonicalName On

    <VirtualHost *:80>
    ServerAdmin webmaster@localhost

    ServerName blog.example.com
    ServerAlias www.blog.example.com

    DocumentRoot /var/www/html

    <Directory /var/www/html/>
    Options FollowSymLinks
    AllowOverride All
    Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.blog.example.com [OR]
    RewriteCond %{SERVER_NAME} =blog.example.com
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    </VirtualHost>
    更多线索
    可能是一个线索:当我在未登录的情况下访问 example.com/blog/wp-admin 时,它会将我重定向到 https://example.com/blog/wp-login.php?redirect_to=https%3A%2F%2Fblog.example.com%2Fwp-admin%2F&reauth=1 .而且我不知道这个“blog.example.com”域来自哪里。
    我在 DigitalOcean 的 Droplet 设置中将“blog.example.com”子域添加到 WordPress Droplet。

    最佳答案

    在 Apache 配置中查看您的服务名称。你把这个 blog.example.com。我相信这应该是 www.example.com

    关于ruby-on-rails - "Request exceeded the limit of 10 internal redirects due to probable configuration error"同时将 WordPress 置于反向代理之后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66978222/

    34 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com