Virtualmin breaking fcgid

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/ 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?



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

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 "" at another Virtual Server's DocumentRoot.

Would it work to put a redirect in the public_html folder for, that redirects to ""?

Hi Andy,

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/

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....

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?

using the button that says Sub-Domain of - 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

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.

but its not to a different virtual server...

surely if your removing that feature there must be another way to make 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....

using sub servers it appears to only allow the site to be put in /home/mangerebridge/domains/ which isn't as nice as being in /home/mangerebridge/public_html/testsite1

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/foo you could just enter foo in that field. In your case, it sounds like maybe you manually changed the config to use a path in the parent domain's directory?

hi Jamie,

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........

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?

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):

  1. Create Virtual Server
    • create a sub-server within a parent
  2. Server Configuration > Website Options
    • verify "FCGId (run as virtual server owner)" is selected
  3. Services > Configure Website > Edit Directives
    • remove domains/ by changing DocumentRoot /home/parent/domains/ to DocumentRoot /home/parent/public_html
    • remove domains/ by changing <Directory /home/parent/domains/> to <Directory /home/parent/public_html>
    • click Save
  4. Services > Configure Website for SSL > Edit Directives
    • remove domains/ by changing DocumentRoot /home/parent/domains/ to DocumentRoot /home/parent/public_html
    • remove domains/ by changing <Directory /home/parent/domains/> to <Directory /home/parent/public_html>
    • click Save
  5. Restart Apache with service apache2 restart (you must do this because saving the directives does not apply them - this should probably be changed in a future release so that it automatically restarts when you save)
  6. Server Configuration > Website Options
    • you can now see "Apachemod_php (run as Apache's user)" is selected
    • you can also see in Server Configuration > PHP Versions that you won't be able to select a PHP version
  7. Edit the appropriate file in /etc/webmin/virtual-server/domains (i.e., the one that is for this sub-server)
    • you will notice public_html_path=/home/parent/domains/
    • change public_html_path to /home/public_html
  8. Restart Apache with service apache2 restart
  9. Server Configuration > Website Options
    • you can now see "FCGId (run as virtual server owner)" is once again selected

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.

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.

Kind of you Jamie. Thank you.