$ sudo vi /etc/apache2/apache2.conf #Debian/Ubuntu systems
$ sudo vi /etc/httpd/conf/httpd.conf #RHEL/CentOS systems

And add/modify/append the lines below:

ServerTokens Prod
ServerSignature Off
Save the file, exit and restart your Apache web server like so:

$ sudo systemctl restart apache2 #SystemD
$ sudo service apache2 restart #SysVInit

How to Hide Apache Version Number and Other Sensitive Info

How to Hide PHP Version Number in HTTP Header