Splitting up httpd.conf

Hi, I am in the progress of setting up a hosting server running on CentOS 8. I would like each site to have a separate config, not keeping all in httpd.conf file.

I changed the module config of Apache (Webmin -> Servers -> Apache Webserver – “Module config” (top left))

“File or directory to add virtual server to” = “httpd.conf” to “/etc/httpd/sites.conf”

It works great, every new site creates a .conf file in the sites.conf folder.

But when I delete a site from virtualmin it does not delete the site config file. Gives an error “no Apache virtual host found”. So I have to manually delete the file.

Deleting mail aliases …
… done

Disabling log file rotation …
… done

Deleting virtual website …
… no Apache virtual host found!

Deleting home directory …
… done

Deleting administration user …
… done

Deleting administration group …
… done

Deleting server details for testsite.com
… done

Restarting PHP-FPM server …
… done

Am I missing something other I need to configure for this to work or is it just best practise to have everything always in the httpd.conf?

Found the solution here : Separate virtual hosts conf file

I needed to manually add this to httpd.conf
IncludeOptional sites.conf/*.conf


1 Like

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.