How to secure LAMP server
To secure your LAMP server you need to make sure all software are updated and close all known vulnerabilities
Hide apache server signature with Apache and PHP version info to avoid risk of attackers using known vulnerabilities to abuse or harm your server.How To Secure PHP vulnerability
Hide PHP Version
PHP version in HTTP response headers may reveal version vulnerabilities and it is best to hide it.
First check which PHP version is installed and active on your server. For example use version command as follow:
Then navigate to php folder or find the location of the active php.ini file and dd the following lines:
How To Secure Apache server?
Keep Apache server updated
First you need to keep your Apache server updated. Run update command at least every month to get the latest films including vulnerability fixes.
Turn off server signature on Apache server
Search for the apache configuration file and set ServerSignature Off to hide version info on any error pages. and set ServerTokens Prod to exclude server detailes in HTTP headers.
For linux Debian or Ubuntu use:
For linux CentOS or Fedora use:
Click "i" to insert the following lines at the end of the file.
ServerTokens Prod
Click ":q" to close vi editor.
Restart apache servcer using following command for Debian or Ubuntu: