benfromaus
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Nginx reverse proxy in subdirectory to docker image@diondesigns this question has everything to do with WordPress.
Most other web apps are entirely capable of being run in a subdirectory via reverse proxy.
The problem is due to WordPress’ over enthusiastic (and frankly unnecessary) redirections.
The NGINX reverse proxy architecture is only becoming more common place as the world moves towards containerisation too.
https://www.susa.net/wordpress/2018/02/docker-wordpress-in-a-subdirectory/
https://serverfault.com/questions/812925/hosting-a-wordpress-blog-using-nginx-as-sub-directory
https://meta.discourse.org/t/installing-wp-in-sub-folder-https-docker-setup/59733
Unfortunately, I think part of the problem is baked into WP Core itself and how it handles URL detection… Even more unfortunately I don’t think it’s going to be resolved any time soon because it is a fairly niche problem and one that (for me so far at least), is incredibly hard to find the root cause of.
@andrewcz Here’s the ugly fix I’ve come up with. It’s not great, I’m not overly proud of it but it at least gets me the outcome I’m after
1. Create a subdomain for your WP e.g.
blog.example.com2. Update your NGINX reverse proxy to point to your WP docker container
3. Install wordpress via the subdomain
blog.example.com4. Update your NGINX reverse proxy to point
/blogto your WP docker container5. Your wordpress will be accessible via
blog.example.comandexample.com/blogWhen you visit
example.com/blogall your wp-includes/wp-content will be loaded via theblog.example.comsite while WordPress will continue to let you visitors click around remaining on theexample.com/blogsiteIf you want to be able to be logged in when you visit
/blog, you can add set yourCOOKIE_DOMAINtoexample.com- This reply was modified 7 years, 5 months ago by benfromaus.