What's the best approach for managing Apache virtual hosts configuration files ?

Issues related to applications and software problems and general support
Post Reply
kavishgr
Posts: 1
Joined: 2020/09/30 06:43:00

What's the best approach for managing Apache virtual hosts configuration files ?

Post by kavishgr » 2020/09/30 06:48:15

Personally, I place all my vhosts configuration files in /etc/httpd/conf.d/vhosts/. There're certain users that like to mimic the environment of debian/ubuntu by creating folders like site-enabled and site-available.

Is there any other ways by which the configuration files can be managed more efficiently ?

BShT
Posts: 585
Joined: 2019/10/09 12:31:40

Re: What's the best approach for managing Apache virtual hosts configuration files ?

Post by BShT » 2020/10/01 12:25:38

this is a matter of personal choice

i don´t like debian stile although a need to support some

i use /etc/httpd/conf.d/ and /etc/httpd/disabled

we have another environment here with /etc/httpd/sites for http and /etc/httpd/ssl for https because is a farm of servers and confs are links at an NFS share

User avatar
KernelOops
Posts: 428
Joined: 2013/12/18 15:04:03
Location: xfs file system

Re: What's the best approach for managing Apache virtual hosts configuration files ?

Post by KernelOops » 2020/10/01 13:24:23

In CentOS 7, I used /etc/httpd/conf.d like BShT above mentioned.

In CentOS 8, I use the new and awesome instance feature, for example, if I create the virtual host like:

/etc/httpd/conf/example.tld.conf

then I can instantly use commands like:

systemctl enable httpd@example.tld
systemctl start httpd@example.tld
systemctl status httpd@example.tld

how awesome is that? :)
--
R.I.P. CentOS :cry:
--

User avatar
jlehtone
Posts: 4531
Joined: 2007/12/11 08:17:33
Location: Finland

Re: What's the best approach for managing Apache virtual hosts configuration files ?

Post by jlehtone » 2020/10/01 13:27:57

There are tools for management of configuration. Some examples are listed in https://wiki.centos.org/SpecialInterest ... agementSIG

The idea of those tools is that you have the config in syntax of the tool and the tool transfers the config to target system / ensures that target has the config.
The benefit is that you have the config in two locations: your "management centre" and the target system. That makes it simpler to reinstall a target system.

User avatar
remirepo
Posts: 447
Joined: 2014/09/21 09:07:12
Location: France
Contact:

Re: What's the best approach for managing Apache virtual hosts configuration files ?

Post by remirepo » 2020/10/01 14:21:40

KernelOops wrote:
2020/10/01 13:24:23
In CentOS 8, I use the new and awesome instance feature, for example, if I create the virtual host like:
Indeed, that is an awesome feature, but each instance is a new set of processes, while multiple vhosts shared the same set of processes.

This can have very different memory consumption if you have a lot of instances/vhosts
Remi's Repository - Forum - Blog

User avatar
KernelOops
Posts: 428
Joined: 2013/12/18 15:04:03
Location: xfs file system

Re: What's the best approach for managing Apache virtual hosts configuration files ?

Post by KernelOops » 2020/10/01 16:09:41

Exactly, each instance is a separate set of processes, which is what I want, for isolation and separation, providing another layer of security.

I use the main httpd configuration to act as a reverse proxy (and caching service) for all the backend instances. I've seen great results with this layout over the more traditional method that I still use in CentOS 7.

I believe the only real downside, is a bit more memory usage for the extra processes that are needed, but that is a small price to pay for the overall performance and security benefits.
--
R.I.P. CentOS :cry:
--

Post Reply