Avoide creation of Admin user of subdomain in the virtualmin

@Stegan “sub-server” has the same “owner” as the parent.
their actual location then would be: /home/domain.club/domains/v2.domain.club but that could be changed

please tell how change the document root after or before the creation of the sub-server and if its not possible then i believe that the redirection is also an option, please guide me how to redirect the sub-server changing the document root is not possible

Sorry for delay in coming back (there seems to be a lot happening here atm)
I think somewhere in Virtualmin this can be done (I just forget where for now) but this could also be done by symlink’ ing the “sub-server” to the actual subdirectory below home/domain.ckub or indeed anywhere.

Give this a try, Webmin->servers->apache

This worked for me credits to @jimr1

The fact that you have the Subdomain account type means you have restored some sort of backup (presumably from cPanel) that has subdomains, and you restored them into subdomains. That’s unfortunate.

You can probably use Virtualmin subdomains like this, though the subdomain account type is mostly unmaintained and mostly not recommended. If you really can’t change your app paths to something reasonable that allows these sites to run as their own user, it may be the easiest option.

@evanv25

how this method can help me in solving the issue i am facing

because it does exactly what you asked

@jimr1 yesterday @joe explained me the sub-server

joe says:

“You do not want a new user. This creates a new website, database, mail config (if you choose), etc. and it puts the data in `/home/top-level-domainname/domains/sub-server-domainname”

and here here i believe that he was saying that if i will go for the creation of the subserver i can avoid the creation of the new user

Right?

not if you want the folder to be under public_html as you are aware that it creates in ~/domains/domain_name/public_html
assume you want bulletins.urdu.rnn.live’s document root to be at ~/public_html/admin.urdu/public/bulletins. This method does work also along with the sub_domain option that you have with the ‘create server’ option you have in virtualmin, but as Joe says the sub_domain option is not open to all .
@evanv25 refers to another thread which explains fully how to do this if the sub_domain on virtualmin server creation does not exist see here

You have enabled the Subdomain account type in Virtualmin. It does literally what you’re asking for, including the ridiculous filesystem layout. The subdomain type in Virtualmin (deprecated years ago, because it’s ridiculous) came from the desire of users to migrate directly from cPanel, including so-called “subdomains” from cPanel.

I really hate the whole concept of “subdomains” as cooked up by the cPanel folks, so we got rid of it. The code lingers, and ends up turned on if you restore a backup that has subdomains. That seems to be what’s happened for you.

Again, I think “subdomains”, as cPanel imagined them, are ridiculous and have security implications nobody should be happy with, but, you seem hellbent to do it that way, so, go for it.

@Joe

i have another idea to make the website fully active, please tell me if its right or wrong.

i do not want to publish the website for the public, i am just working on the making of software/Admin panel and i just want to get some idea from the previous Admin dashboard/panel, so what if i activate it on the localhost using the wamp or xampp

will it work??

Don’t cpanel call it addon domains? subdomain is whatever.mydomain.com or is that what your talking about.


Holy crap! cPanel finally realized cPanel style “subdomains” were a mistake. Will wonders never cease?

2 Likes

@Joe

i have another idea to make the website fully active, please tell me if its right or wrong.

i do not want to publish the website for the public, i am just working on the making of software/Admin panel and i just want to get some idea from the previous Admin dashboard/panel, so what if i activate it on the localhost using the wamp or xampp

will it work??

I have no idea. I have nothing to do with WAMP or XAMPP. Never used them, never seen them.

I think I have the answer to what the OP is trying to do

  1. Files are located in /var/www/abc/public_html/ (we don’t know who owns these files but I guess www-data or something similar)

  2. The OP is trying to create a virtualmin domain and a bunch of subservers with virtualmin with the user who own the files & with the document root of /var/www/abc/public_html/<wherever>

  3. virtualmin creates the domain, correctly, with a new user & document root and for some reason a simple modification to the web app can not be made to point to the new document root. But to be fair I have never come across coded like that as they could be deployed on various different machines with a totally different file structure and just pick up where they have been installed.

The only options I can see open to the OP are

  1. create each domain using the webmin apache module and writing the directives by hand
  2. create each domain using virtualmin then using the webmin apache module edit each domain directives to reflect the correct user and path (document root) and which other directives the OP sees fit to remove or edit.

either way this is not ideal as it will, I guess, cause problems/conflicts with virtualmin’s inbuilt functions for maintaining said domains I would suggest focus should be spent looking at the webapp to see why it is coded in such away.
As a footnote the OP has not related what framework or app he is using for his site(s) given that information it may have been much easier to diagnose the correct way forward to edit the app to reflect the new paths, It may be as simple as a ‘search & replace’ through the source code with a text editor.

These are windows apps so is the OP using a windows machine using WSL to be fair there is nowhere near enough information supplied by the OP.

I agree.
But given that we do know it is a WordPress site (with unknown add-ons) I still find it hard to believe that even the coders at WordPress could have set things up this way.
But we do know it was working on the old server and the OP is trying to set up Virtualmin to run the old “broken” code. It just seems to comes down to the way PHP is understanding locations in the old system vs locations in the new system. We just need a setup to “fool” PHP that the “old” is now the “new”. Perhaps the easiest method is to edit the old code? So option [1] - and when done I can’t see that upsetting Virtualmin.

@Stegan & @jimr1

the website that i want to restore is a static one (PHP based), i have not created it, yesterday i created 12 virtual hosts for the 12 subdomain that were needed, i set the path for each virtual host, list of the virutal host and the their document root given below

Subdomains.Root Domain Document Root
admin.urdu.rnn.live /public_html/admin.urdu/public
aimg.urdu.rnn.live /public_html/admin.urdu/public/NewsFiles/AuVideo
avfile.urdu.rnn.live /public_html/admin.urdu/public/AvFiles
avimg.urdu.rnn.live /public_html/admin.urdu/public/AvFilesImage
bulletins.urdu.rnn.live /public_html/admin.urdu/public/bulletins
geimg.urdu.rnn.live /public_html/admin.urdu/public/others
gimg.urdu.rnn.live /public_html/admin.urdu/public/GalleryImages
nimg.urdu.rnn.live /public_html/admin.urdu/public/NewsFiles/Images
pimg.urdu.rnn.live /public_html/admin.urdu/public/PageFiles
urdu.rnn.live /public_html/urdu/public

now i am trying open them but all virtual hosts are showing error that says " Forbidden

You don’t have permission to access this resource." except “admin.urdu.rnn.live” and "urdu.rnn.live " , these two display the following code when i try to access them

<?php

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
	
    get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
            ->run();```

have all file/directory have the same user:group, sounds like a permissions issue

I’d go further - is that the real cause - the backup came in with the old ACL of the original server

@Stegan i took the full backup with the help of cpanel years ago