| SYSTEM INFORMATION | |
|---|---|
| OS type and version | Ubuntu Linux 24.04.4 |
| Webmin version | 2.641 (Installed using .deb package) |
| Virtualmin version | 8.1.0.gpl (Installed using .deb package) |
| Webserver version | 2.4.67 |
| Related packages | – |
Hello Everyone,
I am trying to use Custom Fields to in Server template to set some custom values in apache virtual host conf file on virtual server creation. But that is not working, it does not expand the variables instead prints as-it-is.
I checked Template Variables | Virtualmin — Open Source Web Hosting Control Panel, which suggests to use $VIRTUALSERVER_FIELD_fieldname format but it is not working. I tried with $FIELD_fieldname too but no luck.
I also looked at custom fields usable in httpd.conf as replacable params - #4 by Joe where Joe suggests the same.
My current template is:
ServerName ${DOM}
ServerAlias www.${DOM}
ServerAlias mail.${DOM}
DocumentRoot ${HOME}/public_html
ErrorLog /var/log/virtualmin/${DOM}_error_log
CustomLog /var/log/virtualmin/${DOM}_access_log combined
ScriptAlias /cgi-bin/ ${HOME}/cgi-bin/
DirectoryIndex index.php index.htm index.html
<Directory ${HOME}/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
Require all granted
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
<Directory ${HOME}/cgi-bin>
Require all granted
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
mydirectve ${VIRTUALSERVER_FIELD_appport}
mydirectve $VIRTUALSERVER_FIELD_appport
mydirectve ${FIELD_appport}
mydirectve $FIELD_appport
mydirectve ${CUSTOMFIELD_appport}
mydirectve $CUSTOMFIELD_appport
mydirectve ${CUSTOM_FIELD_appport}
mydirectve $CUSTOM_FIELD_appport
I created a test site from the WebUI, assigned value 9090 to the field ‘appport’.
But It does not recognize variable and generates .conf as follows:
cat /etc/apache2/sites-enabled/test.conf
<VirtualHost 127.0.0.1:80>
ServerName test
ServerAlias www.test
ServerAlias mail.test
DocumentRoot /home/test/public_html
ErrorLog /var/log/virtualmin/test_error_log
CustomLog /var/log/virtualmin/test_access_log combined
ScriptAlias /cgi-bin/ /home/test/cgi-bin/
DirectoryIndex index.php index.htm index.html
<Directory /home/test/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
Require all granted
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddType text/plain .php
</Directory>
<Directory /home/test/cgi-bin>
Require all granted
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
mydirectve ${VIRTUALSERVER_FIELD_appport}
mydirectve 0UALSERVER_FIELD_appport
mydirectve ${FIELD_appport}
mydirectve $FIELD_appport
mydirectve ${CUSTOMFIELD_appport}
mydirectve $CUSTOMFIELD_appport
mydirectve ${CUSTOM_FIELD_appport}
mydirectve $CUSTOM_FIELD_appport
ProxyPass /.well-known !
RemoveHandler .php
<FilesMatch \.php$>
SetHandler None
AddType text/plain .php
</FilesMatch>
</VirtualHost>
I am doing something wrong? Is this a pro feature? Or the feature is no longer available?
Here Apache is acting just as a proxy, Apps will be running on their own ports. So idea is i will pass a backend application port and Virtualmin will create the site with ProxyPass configured accordingly. Please suggest if there is a native way to do that where I can pass a local port when creating a new Virtual Server like 9090, 9091, 9092 etc.