我无法登录反向PRoxy后的WP。
我在这个WP论坛帖子中发现了同样的“无法登录”问题
https://wordpress.org/support/topic/does-anybody-have-a-working-wordpress-beind-nginx-reverse-proxy-config/
但它已经关闭了。我不能在那里提问或评论,所以在这里打开一个新的。
读了那篇帖子,以及散布在网络上的一百万篇其他帖子,我想我会尝试一下。
我对使用Nginx Unit作为后端不感兴趣,所以我使用我常用的Nginx反向代理+Nginx wordpress后端。
@nginx上的干净WP安装@https://backend.mydomain.com
“wp-config.php”包括
定义('DOMAIN_CURRENT_SITE','');定义('ADMIN_COOKIE_PATH','');定义('COOKIE_DOMAIN','');定义('COOKIEPATH','');define('SITECOOKIEPATH','');定义('WP_HOME','https://backend.mydomain.com' );定义('WP_SITEURL','https://backend.mydomain.com' );
登录@
https://backend.mydomain.com/wp-login.php
显示器
------------------------------------<a href=“https://codex.wordpress.org/WP_Logo“>WP徽标</a>用户名或电子邮件地址[ ]密码[ ][]记住我<a href=“https://codex.wordpress.org/Log_In网站“>登录</a>------------------------------------
当我输入凭证时,
在成功登录后,它会正确重定向到
https://backend.mydomain.com/wp-admin/
&将管理UI显示为登录用户
接下来,我设置reverse-proxy,使用nginx前端@
https://frontend.mydomain.com
@在配置中
上游WP{server-backend.mydomain.com:443;}位置^~/wordpress/{
我对nginx执行“proxy_pass”@https://backend.mydomain.com
代理程序(_P)https://WP网址/;
并将“wp-config”更改为包括
定义('ADMIN_COOKIE_PATH','/wordpress');定义('COOKIE_DOMAIN','frontend.mydomain.com');define('COOKIEPATH','/wordpress')定义('COOKIEPATH','/wordpress');定义('DOMAIN_CURRENT_SITE','https://frontend.mydomain.com/wordpress网站');define('SITECOOKIEPATH','.');if(设置($_SERVER['HTTP_X_FORWARDED_FOR'])){$list=爆炸(',',$_SERVER['HTTP_X_FORWARDED_FOR']);$_SERVER['REMOTE_ADDR']=$list[0];}$_SERVER['HTTP_HOST']='frontend.mydomain.com/wordpress';$_SERVER['REMOTE_ADDR']='https://frontend.mydomain.com/wordpress网站';$_SERVER['REQUEST_URI']='/wordpress'$_服务器['REQUEST_URI'];$_SERVER['SERVER_ADDR']='frontend.mydomain.com/wordpress';定义('WP_HOME','https://frontend.mydomain.com/wordpress网站' );定义('WP_SITEURL','https://frontend.mydomain.com/wordpress网站' );
现在当我登录时@
https://frontend.mydomain.com/wordpress/wp-login.php
它还正确显示WP登录
------------------------------------<a href=“https://codex.wordpress.org/WP_Logo“>WP徽标</a>用户名或电子邮件地址[ ]密码[ ][]记住我<a href=“https://codex.wordpress.org/Log_In网站“>登录</a>------------------------------------
但是@输入凭据,
它从不将Admin UI显示为登录用户
它只是在提交回后重定向
https://frontend.mydomain.com/wordpress/wp-login.php
没有显示或记录错误。
它只是重定向。
所以可以直接登录。但反向复制登录失败。
@罗布斯科特你听起来像是“前一篇帖子”,好像你有了一些线索,该如何让它发挥作用?
有什么主意吗?
比尔