Custom DirectoryIndex for virtual hosts?

I ran across h5ai (https://larsjung.de/h5ai/) earlier today, and think it’d be kind of neat to set that up as a custom index page for one or two of my virtual hosts. To make that work, though, that vhost needs a custom DirectoryIndex entry–and I’d think that this could be helpful for other folks as well. It seems this would take a config entry for the vhost.

I’m having trouble following the syntax of /etc/e-smith/templates/etc/httpd/conf.d/virtualhosts.conf/20virtual_hosts, which looks like the place where this would be set. Any thoughts on how to modify this?

1 Like

Take a look at

/etc/e-smith/templates/httpd/vhost-extras/

It is the sub template of the templates you pointed, you need to create a prop to display or not your configuration

1 Like

h5ai probably is the most popular one on its category (haven’t used it myself but heard of it many years ago). FYI, there are some other alternatives.

@danb35 this how you can read a prop for a specific vhost

https://github.com/stephdl/nethserver-phpsettings/blob/ns7/root/etc/e-smith/templates/httpd/vhost-extra/30directory21PhpAdminValues#L6

$VhostName is the key name and the name of your vhost

so

$phpCustomSettings = $vdb->get_prop("$VhostName",'PhpCustomSettings') || 'disabled';
if ($phpCustomSettings eq 'enabled'){
# do something
} else {
 return "# not enabled in this vhost\n";
}