How to remove/modify the header X-Powered-By for all websites hosted in Plesk for Linux?
# curl -I https://example.com
HTTP/1.1 200 OK
Date: Tue, 01 Jun 2017 00:00:00 GMT
Content-Type: text/html; charset=UTF-8
Note: This solution is available starting from Plesk Obsidian 18.0.31:
How to update Plesk Obsidian to the latest build
Go to Extensions > My Extensions > Panel.ini Editor (the Open button) > the Editor tab add the following lines at the end of the file:
xPoweredByHeader = off
Click the Save button
Go to Tools & Settings > Diagnose & Repair and click repair for “Web & FTP Servers” to rebuild web server configuration.
Note: The same can be done via SSH by editing the file
The following examples describe how to remove/modify the X-Powered-By header for Plesk versions below 18.0.31:
Warning: This guide is intended for Plesk administrators with SSH access to the server. If you are a domain owner, please contact your service provider for assistance with removing/changing the headers.
Removing the X-Powered-By header: For a single domain
Note: The following steps are only working with Apache. When Nginx is installed, it’s possible to modify the
panel.ini file as described in the previous accordion to disable the header server-wide.
Go to Domains > example.com > Apache & Nginx Settings > Add the following directive in Additional directives for HTTP and Additional directives for HTTPS > Click OK to apply changes:
Header unset X-Powered-By
Changing the X-Powered-By header
Connect to a Plesk server via SSH.
Create a directory for custom templates:
# mkdir -p /usr/local/psa/admin/conf/templates/custom/domain
Copy default templates to the created directory:
# cp /usr/local/psa/admin/conf/templates/default/server.php /usr/local/psa/admin/conf/templates/custom
# cp /usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php /usr/local/psa/admin/conf/templates/custom/domain
# cp /usr/local/psa/admin/conf/templates/default/domain/nginxForwarding.php /usr/local/psa/admin/conf/templates/custom/domain
Modify custom templates:
Note: If you want to use two or more words separated by space in the X-Powered-By header (For example, X-Powered-By: My custom header), put these words in quotes. Otherwise, the following error will appear: Template_Exception: nginx: [emerg] invalid number of arguments in “add_header” directive.
Open the file
/usr/local/psa/admin/conf/templates/custom/server.phpin a text editor (for example, vi editor) and change the value of the X-Powered-By header to your own. Save the changes and close the file.
Open the file
/usr/local/psa/admin/conf/templates/custom/domain/nginxDomainVirtualHost.phpin a text editor and change the value of…