Question
How to add additional Apache directives by service plan or globally, so that these directives will not be overwritten by an update?
Answer
The following steps apply to each Service Plan individually. For server wide solution follow the steps from the SSH Terminal section below:
-
Go to Service Plans > Example Plan > Web Server > Additional Apache directives
-
Enter the desired directives in the Additional directives for HTTP and Additional directives for HTTPS fields
-
Scroll down and click on Update & Sync
Note: All newly created domains will receive the specified settings. Existing domains will not be updated. Additional directives set for already existing domains should be changed on a per-domain basis.
SSH Terminal - Server wide solution
-
Connect to the server via SSH
-
Create a configuration file for the directives:
-
Debian-based OS (e.g. Ubuntu, Debian):
# vi /etc/apache2/conf-enabled/zz011_custom_directives.conf
-
RHEL-based OS (e.g. CentOS, RedHat):
# vi /etc/httpd/conf.d/zz011_custom_directives.conf
Note: Apache loads configuration files in alphabetical order, so if it's required to overwrite some values managed by Plesk, make sure the new custom config file is loaded after
zz010_psa_httpd.conf
. For example by naming it aszz011_custom_directives.conf
-
-
Add the desired Apache directives to the newly created file and save the changes
-
Check if the Apache configuration is correct by executing this command:
# apachectl configtest
Expected output:
# Syntax OK
-
Restart Apache by executing this command:
-
Debian-based OS:
# systemctl restart apache2
-
RHEL-based OS:
# systemctl restart httpd
-