• Resolved Anonymous User 18648319

    (@anonymized-18648319)


    I’ve spent more than a month now unsuccessfully digging, asking, posting, etc.

    So far no luck. At all. And pretty much out of time to get it working. So one last hurrah before switching to a CMS that does work for my use case (lots of them to choose from. I *really* want WP to work).

    What I’d like to get is a WORKING config for WordPress behind Nginx reverse proxy.

    So that

    public access is at https://example.com/blog, which proxies to a WP backend.

    the WP backend runs on https//internal.example.com

    I need external users to login successfully at

    https://example.com/blog/wp-login.php

    and for them to see all page & resource links as

    https://example.com/blog/…

    AND for internal users to login successfully at

    https//internal.example.com/wp-login.php

    and for them to see all page & resource links as

    https://internal.example.com/…

Viewing 11 replies - 1 through 11 (of 11 total)
  • First, get the WordPress to work exactly as you want it to work… exactly! From the outside world…

    Then enable the Nginx as a proxy for the host you are using (I would want Apache as the origin or webserver itself… but I’m picky!)…

    Else, get the WordPress to work exactly as you want it to work… exactly! Then…

    Move the site to Cloudflare. You’ll get a very nice DNS service, a few nice extras, a very secure web proxy.

    Cloudflare is how I do things on my own sites… It’s free!!! Unless you want to invest a few dollars into the added features.

    Another way might be to get the WordPress to work exactly as you want it to work… exactly! Then…

    Ask your host to help configure the proxy. My Nginx proxy config won’t work for your server…

    Moderator Yui

    (@fierevere)

    永子

    You can play with on-the-fly substitutions for URL’s
    https://www.nginx.com/resources/wiki/modules/substitutions/
    (not very easy)

    Thread Starter Anonymous User 18648319

    (@anonymized-18648319)

    I’m not interested in Apache, or CloudFlare.
    Nginx proxying works here for dozens of other sites/apps; including CMS’ built with Drupal , OctoberCMS, Strapi & DIY Symfony.
    Standalone unproxied WP also works here without any problem.

    It’s that^, and just that, config that I’m looking to implement. An Nginx frontend reverse-proxying to a WP-on-Nginx instance.

    I’ve already been down the road of ‘try this, that & the other’ dozens of times. Unsuccessfully.

    At this point, I’m looking for a single, demonstrated to work, complete configuration, before throwing in the towel on WP, and returning to a different working CMS solution.

    If I’m understanding your requirement correctly I think the issue is related to wanting two different domains rather than specifically the reverse proxy.

    Have you been able to set up the site correctly, without proxy, i.e. have example.com for one set of users and internal.exampe.com for another?

    By default, WordPress only assumes a singe domain example.com so will always be trying to redirect users accessing via internal.example.com to example.com.

    It is possible to avoid this action, but will need some custom work at the WP level rather than the proxy level.

    Thats my thoughts, happy to be corrected if I’m wrong.

    • This reply was modified 3 years, 6 months ago by Alan Fuller.
    Thread Starter Anonymous User 18648319

    (@anonymized-18648319)

    > I think the issue is related to wanting two different domains

    yes, _AND_

    > than specifically the reverse proxy.

    I need *login* to work in both ‘public’ and ‘local’ instance cases:

    (1) https://example.com/blog/wp-login.php
    (2) https://internal.example.com/wp-login.php

    the best I’m able to manage is, in BOTH cases I see the login screen @ the above url.

    On credentials entry/submit I _am_ able to login successfully (i.e., redirect as logged-in user to dashboard), in the ‘internal’ case, (2)

    But, on same-credentials in case (1), it simply loops back to the login screen. NOT logged in …

    > but will need some custom work at the WP level

    That’s understood. Many iterations of wp-settings config variations have been tried as well, here. So far, none have worked.

    > rather than the proxy level

    Well, the proxy pass etc. settings, any rewrites, etc in the proxy config _do_ need to be setup correctly as well.

    Hence the looking for a complete, working solution. Bits-n-pieces I’ve done. The whole setup, I’ve not managed.

    Sorry, but I have to repeat this question

    Have you been able to set up the site correctly, without proxy, i.e. have example.com for one set of users and internal.exampe.com for another?

    because I think it is key.

    Thread Starter Anonymous User 18648319

    (@anonymized-18648319)

    Have you been able to set up the site correctly, without proxy, i.e. have example.com for one set of users and internal.exampe.com for another?

    Yep. As mentioned above,

    Standalone unproxied WP also works here without any problem.

    Standalone WP works in any & all configurations.

    It’s the *proxied* front-end case that fails on login,

    @huna02 Nginx itself has a script to install a hello world WordPress behind a reverse proxy.

    Spinup a server in your favourite cloud VPS and give this a spin

    https://www.nginx.com/blog/automating-installation-wordpress-with-nginx-unit-on-ubuntu/

    Edit the above to match your preferred setup.

    Answer: yes, lots of people have WordPress running in the way you have described.

    Thread Starter Anonymous User 18648319

    (@anonymized-18648319)

    Took a look at all that.

    That’s not a config that leads to working login at BOTH

    external access, at

    (1) https://example.com/blog/wp-login.php

    , with WP in a url sufolder path, and internally, at

    (2) https://internal.example.com/wp-login.php

    , with WP at a different domain, NOT in a subfolder url path.

    Thread Starter Anonymous User 18648319

    (@anonymized-18648319)

    moved on to other platform.

    Okay – but above I’d seen you describe that you didn’t have Nginx proxy working with WordPress.

    From having WordPress running via proxy, it’s less of a leap to configure accessing this in the manner described.

    The script I pointed out handles all of that initial configuration – I use a similar script to this to achieve a similar thing to your initial description. But I wanted to see if you had a working Nginx proxy, as this would then be a smaller task.

    Q: “does ANYBODY have a WORKING wordpress behind Nginx reverse proxy config?”
    A: “yes”

    Q: “Is it possible to THEN configure more complex location rules?”
    A: “also yes”

    I don’t fully understand the difference between “external” and “internal” in your description – but it sounded like you’d fallen at the first hurdle in any case.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘does ANYBODY have a WORKING wordpress behind Nginx reverse proxy config?’ is closed to new replies.