@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://stackoverflow.com/questions/50848006/docker-reverse-proxynginx-subdirectory-as-root-wordpressapache-multi
https://stackoverflow.com/questions/34090577/wordpress-nginx-proxy-and-subdirectory-wp-login-php-redirects-to-domain/35777445#35777445
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://serverfault.com/questions/813440/reverse-proxy-using-nginx-to-wordpress-app-hosted-using-nginx
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.com
2. Update your NGINX reverse proxy to point to your WP docker container
3. Install wordpress via the subdomain blog.example.com
4. Update your NGINX reverse proxy to point /blog to your WP docker container
5. Your wordpress will be accessible via blog.example.com and example.com/blog
When you visit example.com/blog all your wp-includes/wp-content will be loaded via the blog.example.com site while WordPress will continue to let you visitors click around remaining on the example.com/blog site
If you want to be able to be logged in when you visit /blog, you can add set your COOKIE_DOMAIN to example.com
-
This reply was modified 7 years, 5 months ago by
benfromaus.