大网数据广告活动
网站运营与故障问答

WordPress nginx proxy manager + apache: redirect loop

· 52CE 我爱测

I've moved (manually, db backup + folder transfer) 4 wordpress websites from one host to another, maintaining the same configuration (nginx proxy manager in docker on 80/443 plus apache on 444/https). The ssl terminates on nginx …

问题原文

原帖链接 · Nik Rubblers · CC BY-SA 4.0

I've moved (manually, db backup + folder transfer) 4 wordpress websites from one host to another, maintaining the same configuration (nginx proxy manager in docker on 80/443 plus apache on 444/https). The ssl terminates on nginx (letsencrypt).

The apache configuration is the same (virtual hosts configuration has been simply copied).

3 of the 4 work, 1 goes into a redirect loop (no trailing slash found in any configuration).

EDIT: what would help in the investigation? I've tried disabling the plugins (changing plugin's folder name), disabling the .htaccess file (to get at least access to wp-admin) changing site name/url in the db /served names in apache / A/Cname config in provider dns config with every possible combination to understand what fires the 301 redirects with no effects.

Actually, the apache logs do "move" so the request arrives to nginx proxy manager and then is redirected as it should to apache, but then the redirection happens and something goes wrong.

Any hint about what to investigate?

已采纳解答

原帖链接 · Nik Rubblers · CC BY-SA 4.0

SOLUTION:

I added nginx proxy manager after configuring apache to serve directly the websites. Reading about the best practices on how to correctly serve wordpress behind nginx and apache, I came to the solution to terminate the ssl on nginx but still leaving apache on the ssl configuration (this avoided me to set headers such as x-forwarded-proto and others on nginx and modify wordpress configuration).

The three working wordpress instancess still had the letsencrypt configuration pointing to the (unused, expired) old certificates.

the last (not working) one instead hadn't. Adding the three missing lines enabling letsencrypt ssl configuration and the not anymore used (actually expired and wrong) certificates on the apache vhost configuration file prevents the redirection behaviour.

That's sort of weird: if I am supposed to serve apache on the https side terminating the ssl on nginx, why should apache be cofigured with its own (even fake) certificates? If I only enable ssl engine on apache without specifying the certificates' path, on reloading I get an error.

So I'm actually terminating the ssl on nginx, and let apache think he has his own certificates that he will never use.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2023-03-02)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。