Cobra Forum

Plesk Panel => Webserver => Topic started by: mahesh on Dec 12, 2024, 06:00 AM

Title: How to add additional Apache directives globally on a Plesk server?
Post by: mahesh on Dec 12, 2024, 06:00 AM
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:


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
1.Connect to the server via SSH

2.Create a configuration file for the directives:

#vi /etc/apache2/conf-enabled/zz011_custom_directives.conf
#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 as zz011_custom_directives.conf

3.Add the desired Apache directives to the newly created file and save the changes

4.Check if the Apache configuration is correct by executing this command:

#apachectl configtest
Expected output:

Syntax OK
5.Restart Apache by executing this command:

#systemctl restart apache2
#systemctl restart httpd
[/list]