Creating a sub-server that is accessible from web root of parent

4 posts / 0 new
Last post
#1 Tue, 06/20/2017 - 22:19
h2ojunkie

Creating a sub-server that is accessible from web root of parent

Is there an easy/recommended way to make a sub-server accessible via the parent server's web root?

Example parent server: domain.com sub server: sub.domain.com (but have it accessible via domain.com/sub instead of using the sub.domain.com to access the sub-server)

I know the old sub-domain option allows this, however it's not ideal. This particular sub-directory is a totally separate web-app. The web app (CMS) in the parent server is a huge forum (lots of files and huge DB) and the other is separate app with a huge DB and thousands and thousands of images. Using the parent/virtual server setup is preferred since it keeps the backups separate - and all around makes life much easier for me to have the backups separate. If I use the old sub-domains feature, I can access the app at the URL I need (domain.com/sub), but then everything (parent and sub-server) are all in one massive backup, much harder/longer to restore copies of the live data to my dev environment. I really don't want move the domain.com/sub to a new URL (all those url rewrites, page rank, etc. lost by changing URL). But really want the separate backup features afforded by using sub-servers.

So...the question is. What (if any) is a good way to create a parent server at domain.com, and also create sub-server accessible at domain.com/sub (instead of sub.domain.com) so that both parent and sub server share (as far as the public url is concerned) the same domain - but remain separate server/sub-server for the purpose of virtualmin, backups, etc?

I thought about just putting a symlink in /home/parent/public_html/symlink pointed at /home/parent/domains/subserver/public_html - but I was concerned that would run into symlinksifownermatch issues, or that virtualmin backups would follow that symlink and end up including the entire sub-server in the parent server backup, or SUEX issues, etc. But, is it really as simple as just a symlink in the parent servers web root?

(PS - If this is a duplicate - my apologies. I thought I submitted it the topic, but since it's not showing either it got sent to a moderation que, or I missed hitting the submit button the first time.

Tue, 06/20/2017 - 23:11
Joe
Joe's picture

A link won't be stopped by the SymlinkIfOwnerMatch rule (because the owner will match, as the point of a sub-server is that the sites share an owner). But, I suspect other things will cause trouble...but, I've never tried it, I don't think. If that seems the most intuitive to you, try it and see what happens. Virtualmin backups won't follow symlinks (but it will include the symlink itself), AFAIK, though it special cases log files to include them (logs are symlinked in from the /var/log/virtualmin directory)...but, I don't think any other symlinks get followed for backups. I can't think of why they would be.

Other options include a ProxyPass rule for that subdirectory, a redirect, or just making it a sub-directory and excluding it from your backup (just make sure to create a new backup for just that directory using one of Webmin many backup modules, or a cronjob or your own devising, or whatever). Personally, I like to have everything for a domain in a backup, including all sub-servers, unless they're really huge.

We're working on making proxy rules easier to manage (and the proxy features of Install Scripts are moving down from Pro into GPL in Virtualmin 6), but you can already manage them in the UI. It's probably also possible to make them manageable by regular virtual server owner users by tweaking the configuration a little.

--

Check out the forum guidelines!

Wed, 06/21/2017 - 03:15
h2ojunkie

I thought of making that symlink, then just exclude the symlink from the parent server backup. I'd have to recreate the symlink after a restore, but that's no big issue. I just couldn't believe it could be that simply. But maybe this really is the KISS option is the best option,

Thanks!

Fri, 07/21/2017 - 01:05
h2ojunkie

Just wanted to report back that the KISS option of a sub server with a symlink in the parent server has been working perfectly.

Topic locked