Recently we migrated an application from cpanel to virtualmin manually and we are struggling to understand how to create a virtualhost which points to an existing document root. In cpanel you can do this with an addon domain with same document root and also you can install a separate ssl certificate.
Example: https://primary.com (ssl enabled and pointing to /home/primary/public_html) https://secondary.com (trying to point to the same document root /home/primary/public_html with a separate ssl certificate)
I know you can use alias for this purpose but alias wont allow you to install a new certificate.
https://www.virtualmin.com/node/37631
I followed the above instructions and edited the document root manually ‘/etc/httpd/conf/httpd.conf’ to point to the same path, but it leads to some other serious issues…
PHP script execution mode changes to Apache mod_php and cannot be changed
<Directory /home/primary.com/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
AddHandler fcgid-script .php5.6
FCGIWrapper /home/primary.com/domains/secondary.com/fcgi-bin/php5.6.fcgi .php
FCGIWrapper /home/primary.com/domains/secondary.com/fcgi-bin/php5.fcgi .php5
FCGIWrapper /home/primary.com/domains/secondary.com/fcgi-bin/php5.6.fcgi .php5.6
<Directory /home/primary.com/domains/secondary.com/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
<Directory /home/primary.com/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
AddHandler fcgid-script .php5.6
FCGIWrapper /home/primary.com/fcgi-bin/php5.6.fcgi .php
FCGIWrapper /home/primary.com/fcgi-bin/php5.fcgi .php5
FCGIWrapper /home/primary.com/fcgi-bin/php5.6.fcgi .php5.6
<Directory /home/primary.com/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted