I'm not sure if this is a bug or not
when editing a subdomain via the 'website options' for a brand new subdomain the script execution type is set to fcgid and the Website documents sub-directory field is set to the path where the contents live which for example is /home/mangerebridge/public_html/admin when submitting that page it comes up with an error saying it can not start with a / so I change it to just admin, this then breaks the site by changing the docmentroot and directory handlers in httpd.conf to /home/mangerebridge/domains/admin.mangerebridge.co.nz/admin which of course isn't where the content actually is I then edit the http directives of the site to put it back to the correct directory, which makes the website slightly work again, however after manually fixing this no matter what I do the script execution type in virtualmin goes and sets itself to mod_php, I have checked a php info of the site and the site is actually still running in fcgid as it should be, however virtualmin just gets it wrong, which then stops me changing the php version as well manually changing the documentroot and directory parts back to the broken ones then fixes the execution type but of course breaks the website
do you have any ideas? either to stop the website documents subdirectory needing manually changing in the first place or how to get virtualmin to correctly get that its actually running as fcgid?
Submitted by AskewDread on Tue, 06/07/2016 - 05:02 Pro Licensee Comment #1
Submitted by AskewDread on Tue, 06/07/2016 - 05:23 Pro Licensee Comment #2
I have found editing the /etc/webmin/virtual-server/domains/146456994731255 file and changing the paths to the ones I have set manually allows me to choose fcgid again, however I still need to know why it breaks in the first place
Submitted by andreychek on Tue, 06/07/2016 - 09:27 Comment #3
Howdy -- I believe the issue here is that Virtualmin expects the DocumentRoot to be within the public_html folder of the directory that has been setup for that particular Virtual Server.
So in this particular case here, it sounds like your goal is to point the DocumentRoot for the domain "admin.mangerebridge.co.nz" at another Virtual Server's DocumentRoot.
Would it work to put a redirect in the public_html folder for admin.mangerebridge.co.nz, that redirects to "mangerebridge.co.nz/admin/"?
Submitted by AskewDread on Tue, 06/07/2016 - 13:39 Pro Licensee Comment #4
not quite..... I want the documentroot inside the folder in the public_html of the owner folder where it should be...
the issue im getting is
Create a new sub domain in apache the documentroot etc is set correctly to /home/mangerebridge/public_html/testsite
go into Server Configuration > Website Options > change something like max execution time to something different > Click Save it then comes up with an error saying 'Failed to save website options : Website documents sub-directory cannot start with or end with /'
by default on creation the 'website documents sub directiory' is set to '/home/mangerebridge/public_html/testsite' but to actually save any settings I have to change that to something else... so for example I change it to just 'testsite' that then goes and changes the apache site's documentroot to /home/mangerebridge/domains/testsite.mangerebridge.co.nz/testsite
which of course breaks it :) - so its basically breaking that website documents sub directory field... and im not sure if its a bug or something wrong with my config....
Submitted by andreychek on Tue, 06/07/2016 - 14:09 Comment #5
Just to clarify -- when you added this particular domain, did you do so by setting up a Sub-Server, and then change the DocumentRoot to where it is now?
Or did you enable the super-secret "Sub-Domain" option, and then add it as a Sub-Domain?
Submitted by AskewDread on Tue, 06/07/2016 - 14:34 Pro Licensee Comment #6
using the button that says Sub-Domain of parentdomain.co.nz - I don't recall enabling anything for that, but I have been using virtualmin a long time so maybe :)
and the document root was already correct its only when using the Website option page that it breaks it
Submitted by andreychek on Tue, 06/07/2016 - 15:31 Comment #7
Okay, you may be seeing a bug with that particular feature. We'll see if Jamie has a comment regarding that.
However, note that Sub-Domains are a deprecated feature that they've been working on removing. As of now, they aren't available at all unless enabled in the advanced options.
The recommended way of accomplishing what you're describing, would be to add a Sub-Server, and then redirect from the Sub-Server to the desired directory in the other Virtual Server.
However, let's see if Jamie has a comment as to why you're receiving that particular error, as that should in theory work even if it is hidden in the advanced options.
Submitted by AskewDread on Tue, 06/07/2016 - 15:38 Pro Licensee Comment #8
but its not to a different virtual server...
surely if your removing that feature there must be another way to make whatever.domainname.com and have it go into a subfolder of the parent domains public_html without having to manually redirect to another place :/
sub domains are a pretty standard thing....
Submitted by AskewDread on Tue, 06/07/2016 - 15:42 Pro Licensee Comment #9
using sub servers it appears to only allow the site to be put in /home/mangerebridge/domains/testsite1.mangerebridge.co.nz/public_html which isn't as nice as being in /home/mangerebridge/public_html/testsite1
Submitted by JamieCameron on Tue, 06/07/2016 - 23:58 Comment #10
So Virtualmin expects that the website documents directory be something under the domain's home dir - for example, if you wanted it to be
/home/yourdomain/fooyou could just enter
fooin that field. In your case, it sounds like maybe you manually changed the config to use a path in the parent domain's directory?
Submitted by AskewDread on Wed, 06/08/2016 - 01:14 Pro Licensee Comment #11
as far as I know I haven't changed anything, I believe the subdomain option is supposed to create the path inside the public_html?
no matter what is entered into that field it changes the document root to /home/yourdomain/domains/subdomain.yourdomain/subdomain instead of where it creates in when you create it using virtualmin........
Submitted by JamieCameron on Fri, 06/10/2016 - 01:40 Comment #12
So there are two kinds of sub-domain in Virtuamin - the type that puts the directory in /home/parent/public_html/subdom (which is deprecated), and the type that uses /home/parent/domains/subdom/public_html . Is there a particular reason why you prefer to use a sub-directory under the parent's web root?
Submitted by c_prompt on Thu, 09/14/2017 - 10:41 Comment #13
I think I can recreate this problem with the following steps and without using the "super-secret Sub-Domain" (assumes sub-server template defaults to FCGId):
In other words, manually modifying directives without also manually changing the public_html_path in /etc/webmin/virtual-server/domains causes the problem. My guess is there's probably some functionality that needs to automatically update the file in /etc/webmin/virtual-server/domains when the document root is changed (or something that puts them in sync).
Here's an example context for why you'd want to manually change a sub-server document root to it's parent: I run a CMS platform that allows users to private-label (e.g,. custom domain name, change themes/css) and run their own forum/community/website. Because I want each user to have their own SSL certificate, and because the platform can accommodate more than the Let's Encrypt maximum 100 multi-domains, and because Virtualmin doesn't allow separate SSL certificates for alias domains, I have to set each up as a sub-server with their own "Apache website enabled" (so I can issue Let's Encrypt certificates for each via Server Configuration > Manage SSL Certificate). They don't need their own Apache website as the parent/centralized website deals with the private-label/custom domain functionality. However, I have to point the sub-servers' document roots to the parent directory so functionality can be served properly. Make sense?
Above, andreychek suggested "to put a redirect in the public_html folder" and "[t]he recommended way of accomplishing what you're describing, would be to add a Sub-Server, and then redirect from the Sub-Server to the desired directory in the other Virtual Server." I might be missing why this is preferred but it doesn't seem like the most efficient way (and I expect the redirection would harm SEO too). You just need a simple way to serve the content from the parent.
Submitted by JamieCameron on Sat, 09/16/2017 - 10:45 Comment #14
Yeah, changing the configs "underneath" Virtualmin like this will cause all kinds of unpredictable breakage.
What we really need to implement is support for alias domains that can have their own SSL certs. This isn't trivial due to the way Apache works, but I will put it on our TODO list.
Submitted by c_prompt on Tue, 09/19/2017 - 17:04 Comment #15
Kind of you Jamie. Thank you.