Control Web Panel

WebPanel => Apache => Topic started by: kandalf on May 16, 2021, 10:18:38 PM

Title: Create httpd template to automatically add admin subdomain
Post by: kandalf on May 16, 2021, 10:18:38 PM
I want to create a httpd template that automatically add a "admin" subdomain and want that the SSL create the certificates to the main domain and to the subdomain.

I'm working with Yii2 framework for website development and I have the code separated in 2 folders frontend and backend, I want to install the website with a domain like and use a template to automatically create the that will point to the backend folder.

I already have a template for this type of structure but usualy I access like but this client want to use, how can I manage to do that. This website will required to have ssl from Let's Encrypt.

This is my current template without the admin subdomain
Code: [Select]
<VirtualHost %ip%:%apache_port%>
ServerName %domain_idn%
ServerAdmin webmaster@%domain%
DocumentRoot %docroot%/frontend/web
UseCanonicalName Off
ScriptAlias /cgi-bin/ %docroot%/cgi-bin/
    Alias /backend/ %docroot%/backend/web/

CustomLog /usr/local/apache/domlogs/%domain%.bytes bytes
CustomLog /usr/local/apache/domlogs/%domain%.log combined
ErrorLog /usr/local/apache/domlogs/%domain%.error.log

# Custom settings are loaded below this line (if any exist)
# IncludeOptional "/usr/local/apache/conf/userdata/%user%/%domain%/*.conf"

<IfModule mod_setenvif.c>
SetEnvIf X-Forwarded-Proto "^https$" HTTPS=on

<IfModule mod_userdir.c>
UserDir disabled
UserDir enabled %user%

<IfModule mod_suexec.c>
SuexecUserGroup %user% %group%

<IfModule mod_suphp.c>
suPHP_UserGroup %user% %group%
suPHP_ConfigPath %home%/%user%

<IfModule mod_ruid2.c>
RMode config
RUidGid %user% %group%

<IfModule itk.c>
AssignUserID %user% %group%

<Directory "%docroot%/frontend/web">
Options -Indexes -FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
    <Directory "%docroot%/backend/web">
Options -Indexes -FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch