查看9条回复-1条到9条(共9条)
  • 嗨,比尔,

    我觉得你没有在wp-config.php中定义管理位置……从你对它的描述来看,这听起来有点明显🙂

    试着想想这可能在链条中的什么位置。

    我*确实*使用Nginx Unit根据uri匹配进行传递(对于“/wp-admin/”),这可能就是您需要定义的所有内容(可能尝试将其作为Nginx.conf中的位置)

    对不起,我现在可以在顶部的配置中看到它的定义。

    尝试将以下内容添加到您的nginx.conf服务器指令中–您需要在前端部分中这样做:

    server_name_in_redirect关闭;

    这可能就足够了。

    我想也许你的代理通行证应该在位置/wp-admin/在您的前端指令。但我想看看所有的nginx.conf来确定。

    螺纹起动器 billatw0rd压力t0rg

    (@billatw0rdpressd0t0rg)

    你好,Rob,

    谢谢你的帮助!

    我的配置中充斥着大量的评论和注释。
    所以我清理了它们,并在下面粘贴了我的前端和后端nginx配置。我希望我没有在复制粘贴过程中大吃大喝!

    前台.mydomain.com.conf...映射$http_upgrade$connection_upgrade{默认升级;''关闭;}上游PHPFPM{服务器unix:/run/php-fpm.sock;keepalive 128;}上游WP{server-backend.mydomain.com:443;}...服务器{收听192.168.1.50:443 ssl http2;server_name frontend.mydomain.com;root/dev/null;自动索引关闭;autoindex_exact_size关闭;autoindex_localtime打开;索引index.php index.html;...位置^~/wordpress/{代理程序(_P)网址:https://WP/;过期-1;代理缓冲关闭;proxy_cookie_domain frontend.mydomain.com$host;proxy_hide_header Access-Control-Allow-Headers;代理http版本1.1;proxy_pass_header Access-Control-Allow-Origin;proxy_pass_header访问控制允许方法;more_set_headers“访问控制允许源:*”;more_set_headers“Access-Control-Allow-headers:X-Requested-With,Content-Type,Authorization,Lang”;more_set_headers“访问控制允许方法:POST、GET、PUT、DELETE”;more_set_headers“Access-Control-Allow-Credentials:true”;代理_直接关闭;proxy_set_header接受“application/json”;proxy_set_header连接$Connection_upgrade;proxy_set_header内容类型“application/json”;proxy_set_header主机$http_Host;proxy_set_header HTTPS打开;proxy_set_header升级$http_Upgrade;$proxy_add_X_Forwarded_f的proxy_set_header X-Forwarded-For;proxy_set_header X-Forwarded-Host$服务器名称;proxy_set_header X-Forwarded-Port$server_Port;proxy_set_header X-Forwarded-Proto https;proxy_set_header X转发协议https;proxy_set_header X-Forwarded-Server$host;proxy_set_header X-NginX-proxy“Y”;proxy_set_header X-Real-IP$remote_addr;proxy_set_header X-Script-Name/wordpress;proxy_set_header X-SSL主题$SSL_client_s_dn;proxy_set_header X-SSL颁发者$SSL_client_i_dn;proxy_ssl_certificate“/home/web/ssl/client.backend.crt”;proxy_ssl_certificate_key“/home/web/ssl/client.backend.key”;proxy_ssl_name backend.mydomain.com;proxy_ssl_session_reuse关闭;proxy_ssl_trusted_certificate“/home/web/ssl/ca.crt”;proxy_ssl_verify关闭;server_name_in_redirect关闭;...}...}后台.mydomain.com.conf服务器{收听192.168.1.50:443 ssl http2;服务器名称backend.mydomain.com;root/home/web/wordpress;索引.php;hide_server_tokens打开;security_headers打开;security_headers_referrer_policy unsafe-url;设置$CSP_HOSTS“https://*.mydomain.com”;设置$CSP“default-src'self'https://*.mydomain.com;”;ssl_client_certificate“/home/web/ssl/ca.crt”;ssl_certificate“/home/web/ssl/server.backend.crt”;ssl_certificate_key“/home/web/ssl/server.backend.key”;ssl_verify_client关闭;ssl_verify_depth 2;location=/favicon.ico{log_not_found off;access_log offlocation=/robots.txt{allow all;log_not_found off;access_log off位置/{try_files$uri$uri//index.php?$args;}位置~\.php${包括fastcgi.conf;fastcgi_param SSL_CLIENT_CERT$SSL_CLIENT_raw_CERT if_not_empty;fastcgi_param SSL_CLIENT_FINGERPRINT$SSL_CLIENT_FINGERPRINT if_not_empty;fastcgi_param SSL_CLIENT_VERIFY$SSL_CLIENT_VERIFY if_not_empty;fastcgi_intercept_errors打开;fastcgi_pass PHPFPM;fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_SCRIPT_name;}位置~*\。(js|css|png|jpg|jpeg|gif|ico)${expires max;log_not_found off;}...}

    通过这种配置,我看到了与OP中相同的行为–
    –直接登录到后端,重定向到管理面板
    –登录重定向回登录,无管理面板访问权限

    比尔

    螺纹起动器 billatw0rd压力t0rg

    (@billatw0rdpressd0t0rg)

    大部分配置都是从其他帖子中抄袭过来的。除此之外,我不担保有多少
    (a) 我以前看过
    (b) 在这两种情况下,我都可以进入登录屏幕。

    我刚刚尝试了另一个封闭问题中提到的其他后端。

    在Drupal和Octobercms的基本安装中,登录和访问管理面板既可以直接访问后端,也可以通过反向代理前端。我对Strappi一无所知,只知道它是一个Node应用程序,我不想把它搞砸。

    螺纹起动器 billatw0rd压力t0rg

    (@billatw0rdpressd0t0rg)

    @罗布斯科特

    >但我想看看所有的nginx.conf来确定。

    如果这不是你想要的(全部),请告诉我。

    谢谢!

    很抱歉耽搁了,我有一个星期没有上班。

    我想知道您是否正在从后端到前端循环http<>https。

    或者,您的问题可能是如何处理位置/wp-admin/(即wp-login.php试图将您重定向到的位置)。

    如果您尝试在登录后加载/wp-admin/,是否有效?
    如果添加/wp-admin/index.php会怎么样?

    你为什么不喜欢Nginx Unit?

    螺纹起动器 billatw0rd压力t0rg

    (@billatw0rdpressd0t0rg)

    你好,>我想知道您是否正在从后端到前端循环http<>https。我已经为https设置了所有内容。前端是https。后端是https。证书在两个方向上进行验证。我看不到任何作为http的流量或链接的痕迹。除了正确设置外,您还想检查“循环”吗?>或者,您的问题可能是如何处理位置/wp-admin/(即wp-login.php试图将您重定向到的位置)。>如果您尝试在登录后加载/wp-admin/,是否有效?不。转到url->https://frontend.mydomain.com/wordpress/wp-login.php输入凭据并单击登录重定向到->https://frontend.mydomain.com/wordpress/wp-login.php转到url->https://frontend.mydomain.com/wordpress/wp-admin/重定向到->https://frontend.mydomain.com/wordpress/wp-login.php?redirect_to=https%3A%2F%2Ffrontend.miydomain.com%2Fwordpress%2Fwordbress%2Fwp-管理员%2F&reauth=1>如果添加/wp-admin/index.php会怎么样?转到url->https://frontend.mydomain.com/wordpress/wp-admin/index.php重定向到->https://frontend.mydomain.com/wordpress/wp-login.php?redirect_to=https%3A%2F%2Ffrontend.miydomain.com%2Fwordpress%2Fwordbress%2Fwp-admin%2Index.php&reauth=1>你为什么不喜欢Nginx Unit?它的使用远不如nginx广泛。它的文档和帖子都很薄;nginx+php-fpm是可扩展的,很容易找到。当前版本中(仍然?)缺少TLS 1.3密码套件支持。而且,这应该适用于WP。事实上,它没有文档化@WP,似乎无法开箱即用,而且似乎没有人,据我所知,这对我来说是一个很大的危险信号。所有必要的猜测都向我提出了重写假设的问题,并让我质疑幕后的真相。

    我已经为https设置了所有内容。

    这不是我的观点——我的观点是关于你是如何代理的;这是特定于端口的。

    我不完全理解您的用途,也不理解您对边缘案例设置的重新文档记录的期望。你能描述一下为什么你希望记录这个设置吗?管理和前端分离的好处是什么?

查看9条回复-1条到9条(共9条)
  • 主题“反向代理后无WP登录。只需重定向循环。”对新回复关闭。