How to use Plesk to add additional Apache directives server wide

November 9, 2023 / Plesk

This guide will explain how to add additional Apache directives server wide using SSH terminal.

Let us follow the steps-

  1. Access the SSH terminal.
  2. Generate a configuration file for the directives-
    1. Debian-based OS (e.g. Debian, Ubuntu)-
      # vi /etc/apache2/conf-enabled/zz011_custom_directives.conf
    2. RHEL-based OS (e.g. RedHat, CentOS)-
      # vi /etc/httpd/conf.d/zz011_custom_directives.conf
      Important- As Apache loads configuration files alphabetically; ensure that the custom configuration file overwrites any values managed by Plesk by naming it, for instance, as “zz011_custom_directives.conf” to load it after “zz010_psa_httpd.conf”.
  3. Add the chosen Apache directives to the recently generated file and then “Save” the changes.
  4. To check whether the Apache configuration is right, run the following command-
    # apachectl configtest
    The predicted output is-
    # Syntax OK
  5. Now, restart Apache by running the below command-
    1. Debian-based OS-
      # systemctl restart apache2
    2. RHEL-based OS-
      # systemctl restart httpd

This way, you can use Plesk to add additional Apache directives server wide. Hope you liked our article.

Dominos Search