Title: Nginx -&gt; Docker -&gt; Path mapping
Last modified: August 31, 2016

---

# Nginx -> Docker -> Path mapping

 *  [fluxxo](https://wordpress.org/support/users/fluxxo/)
 * (@fluxxo)
 * [10 years ago](https://wordpress.org/support/topic/nginx-docker-path-mapping/)
 * 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
   [http://portal/](http://portal/) and a website will popup.
    [http://portal](http://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 [http://portal/dashboard1](http://portal/dashboard1) accesses another container
   running the desired dashboard, [http://portal/report1](http://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 [http://dockerhost5:8002](http://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 http://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 [http://portal/blog](http://portal/blog).
 * Actually, the pure content is shown, e.g. [http://portal/blog/?p=1](http://portal/blog/?p=1).
   As soon as I want to access wp-admin, the URL changes to [http://portal/wp-admin](http://portal/wp-admin)
   which is actually wrong, because it should ne [http://portal/blog/wp-admin](http://portal/blog/wp-admin)
 * What did I try?
 * I set the WP_HOME and WP_SITEURL to [http://portal/blog](http://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](https://wordpress.org/support/users/diondesigns/)
 * (@diondesigns)
 * [10 years ago](https://wordpress.org/support/topic/nginx-docker-path-mapping/#post-7418765)
 * 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](https://wordpress.org/support/users/kegowole/)
 * (@kegowole)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/nginx-docker-path-mapping/#post-8808728)
 * Hey thanks for the answer DionDesigns with your information and following [this nginx reverseproxy with docketr tutorial](https://tutorials.technology/tutorials/30-how-to-use-nginx-reverse-proxy-with-docker.html)
   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.

## Tags

 * [docker](https://wordpress.org/support/topic-tag/docker/)
 * [nginx](https://wordpress.org/support/topic-tag/nginx/)
 * [reverse proxy](https://wordpress.org/support/topic-tag/reverse-proxy/)

 * In: [Localhost Installs](https://wordpress.org/support/forum/localhost-installs/)
 * 2 replies
 * 3 participants
 * Last reply from: [kegowole](https://wordpress.org/support/users/kegowole/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/nginx-docker-path-mapping/#post-8808728)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
