Ubuntu服务器上Next.js与WordPress同域名代理部署的重定向循环问题求助
Ubuntu服务器上Next.js与WordPress同域名代理部署的重定向循环问题求助
Hey there! 我刚接触服务器配置,要是用错术语还请多多包涵😅
我正在Ubuntu服务器上部署Next.js和WordPress博客,想让主域名 example.com 指向Next.js应用,example.com/blog 指向WordPress博客。目前本地测试时,Next.js能在localhost:3000正常运行,WordPress在localhost:81也没问题,我用Apache做反向代理来实现这个配置。
我的Apache虚拟主机配置文件内容如下:
<VirtualHost *:80> ServerName example.com ProxyPreserveHost On ProxyPass /blog http://localhost:81/ ProxyPassReverse /blog http://localhost:81/ ProxyPass / http://localhost:3000/ ProxyPassReverse / http://localhost:3000/ </VirtualHost>
配置完成后,example.com 和 example.com/blog 都能正常访问,但当我打开具体的博客文章比如 example.com/blog/post-slug 时,就会触发以下错误:
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: http://example.com/blog
我的WordPress .htaccess 文件配置是这样的:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /blog/index.php [L] </IfModule>
有没有大佬能帮忙分析下这个重定向循环的问题出在哪,该怎么解决呀?提前感谢大家的帮助!
备注:内容来源于stack exchange,提问作者Sandeep Solanki
相关产品推荐
相关产品推荐

