Serve bedrock with simulated subdirectory

Our client, at present, has a single wordpress site they’d like to deploy with Bedrock. However, they use an nginx forward proxy on another server to send all traffic to /blog/ to our bedrock instance.

The client requires that all blog content as well as wordpress admin content render from urls as so:

http://client.com/blog/my-custom-post-name/
http://client.com/blog/wp-admin
http://client.com/blog/wp/wp-login.php?redirect_to=http%3A%2F%2Fclient.com%2Fwp%2Fblog%2Fwp%2Fwp-admin%2F&reauth=1

We have solved the rendering of the blog content ( web/app/themes/etc/etc ) with an nginx location block like so

location /blog {
        root  /srv/www/site.com/current/web/app;
        try_files $uri $uri/ /index.php?$args;
  }

#assure that some static files are served
  location ~ ^/blog/app/(.*)$ {
        root  /srv/www/site.com/current/web/app;
        try_files /$1 /$1/ /index.php?$args;
  }

When we attempt to do the same for the /web/wp/ folders, we can not get nginx to correctly render the files. We can get the locations to properly resolve to the files, but nginx simply hands back the text file ( for example you get a download of wp-login.php ) rather than rendering the php and returning the html.

Anyone have any idea how we can make this work?

First issue I see is that your web root should always point to just /web and NOT /web/app.

@swalkinshaw

I would ordinarily agree, however, you’ve commented on the single configuration that is actually solving a key problem, which was that initially any files at a uri such as /client.com/blog/app/themes/jupiter/css/style.css would return 404 if there was not an explicit rule that mapped them to the /web/app subdirectory.

The issue we’re facing now is that all the /wp content will not render appropriately.