• Hi,

    I am not a strong wordpress user (even less an admin) – but a co-worker approached me and asked if I could set him up a wordpress installation in our pretty cool docker installation. Of couse, it’s a matter of a few minutes I thought ?? Having spent about 2 days now, I am seeking support here.

    Setup is as follows:

    My company has an internal domain, let’s say we can call our central portal like https://portal/ and a website will popup.
    https://portal is actually a host with a docker container running an nginx acting as a reverse proxy dispatching several URLs to yet other docker container running webservers in them.

    Example:

    URL https://portal/dashboard1 accesses another container running the desired dashboard, https://portal/report1 accesses a docker container creating a specific report.

    Now I’ve setup an Image witrh wordpress, extending from the official docker image. It’s up and running and accessible on https://dockerhost5:8002 – I can open the install panel, publish posts and so on.
    Up to here, all is fine!

    Now we extended our nginx-config file like so:

    location /blog {
          proxy_pass https://dockerhost5:8002;
          rewrite ^/blog/(.*) /$1 break;
          proxy_set_header Host $http_host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

    I wanted the blog to be available under https://portal/blog.

    Actually, the pure content is shown, e.g. https://portal/blog/?p=1. As soon as I want to access wp-admin, the URL changes to https://portal/wp-admin which is actually wrong, because it should ne https://portal/blog/wp-admin

    What did I try?

    I set the WP_HOME and WP_SITEURL to https://portal/blog – this works as long as I just want to read blog posts. As soon as I hit /blog/wp-admin it will rewrite to /wp-admin.

    I tried several rewqrite rules & forwardings, all yielding finally to a redirect/rewrite to /wp-admin instead of /blog/wp-admin

    I googled several results, but no one handled a setup like this. The blogs are all under root, but I need it to be under a subfolder.

    Is there a solution to this?

    I hope you guys know what to change!

    Best, Fluxxo

Viewing 2 replies - 1 through 2 (of 2 total)
  • Dion

    (@diondesigns)

    This line:

    rewrite ^/blog/(.*) /$1 break;

    would appear to be rewriting /blog/wp-admin to /wp-admin. Try deleting that line and see if things are fixed.

    Beyond that, you should consider posting your problem in a support forum for nginx since it’s really not related to WordPress.

    kegowole

    (@kegowole)

    Hey thanks for the answer DionDesigns with your information and following this nginx reverseproxy with docketr tutorial I was able to setup wordpress to load balance the work.
    Now I have db issues, but a cache will solve the problem (I hope)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Nginx -> Docker -> Path mapping’ is closed to new replies.