To hide the PHP version information from being displayed in the server response headers in Nginx, you can modify your Nginx configuration file.
Here’s an example of how to do it:
-
Open the Nginx configuration file:
sudo nano /etc/nginx/nginx.conf
-
Add the following line inside the
server
block:server_tokens off;
-
Save the changes and exit the editor.
-
Restart Nginx to apply the changes:
sudo systemctl restart nginx
This will disable the sending of Nginx and PHP versions in the response headers. You can verify this by checking the response headers from a browser or using the curl
command.