Home / How to configure multiple instances of Apache HTTPD on the same server in AlmaLinux?

How to configure multiple instances of Apache HTTPD on the same server in AlmaLinux?

  • You need to copy instance specific configuration file located at /usr/share/doc/httpd/instance.conf to /etc/httpd/conf/newinstance.conf

cp /usr/share/doc/httpd/instance.conf /etc/httpd/conf/newinstance.conf

  • Use the Listen option to change the port to run simultaneously with other httpd.service as below:

Listen 81

  • This configuration will be the default when running httpd@newinstance.service

systemctl start httpd@newinstance.service

  • Some changes expected from the default are:
  1. The default log files names are prefixed with the newinstance name.
  2. DefaulltRuntime and Pidfile renamed to newinstance.
  3. conf.modules.d is included but /etc/httpd/conf.d is not included by default.

You can reload instance httpd@.service to reload when httpd.service is reloaded. For instance, logrotate will reload the only httpd.service when logs are rotated. To accomplish this, create a drop-in file for the instance as below:

[Unit]ReloadPropagatedFrom=httpd.service

Leave a Reply