Hi friends,
It is a good practice to hide apache and php version. By default, Apache web server and PHP will display complete details of version, which is running on the server. This version information can be seen in the HTTP response header.
You can disable Apache and PHP version by following steps :-
1. Apache :- Open Apache conf file and edit below lines to hide Apache version.
[root@linuxbox ~] # vim /usr/local/apache2/conf/httpd.conf
ServerTokens Prod
ServerSignature off
[root@linuxbox ~] # /usr/local/apache/bin/httpd -k stop
[root@linuxbox ~] # /usr/local/apache/bin/httpd -k start
2. PHP :- Open php.ini file and edit below line to hide php version.
[root@linuxbox ~] # vim /usr/local/lib/php.ini
Search for below line :-
expose_php = On
And change it to:
expose_php = Off
Finally restart your server again for the new changes to take effect:
[root@linuxbox ~] # /usr/local/apache/bin/httpd -k stop
[root@linuxbox ~] # /usr/local/apache/bin/httpd -k start
Now you can check Apache Header through below command.
[root@linuxbox ~] # curl -I http://www.example.com/index.php
HTTP/1.1 301 Moved Permanently
Date: Sun, 06 May 2012 07:28:04 GMT
Server: Apache
Location: http://linuxbox.example.com/
Content-Type: text/html; charset=iso-8859-1
Now your server is more secure from the attackers, it will display only Apache server no more descriptions in header.
=========================================================================
Enjoy Linux !!!
Today, I was installing “openldap-2.4.28.tgz” package and I got below error.
[root@piyush openldap-2.4.28]# ./configure –with-tls=openssl
configure: error: BDB/HDB: BerkeleyDB not available
After reading installation doc of openldap and README file, found that Berkeley DB is required for slapd.
SLAPD: BDB and HDB backends require Oracle Berkeley DB 4.4 – 4.8, or 5.0 – 5.1. It is highly recommended to apply the patches from Oracle for a given release.
So I downloaded DB4 and installed via below steps :-
[root@piyush ~]# cd /opt
[root@piyush opt]# wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
[root@piyush opt]# tar –zxvf db-4.8.30.NC.tar.gz
[root@piyush opt]# cd db-4.8.30.NC
[root@piyush db-4.8.30.NC]# cd build_unix
[root@piyush db-4.8.30.NC]# ../dist/configure –prefix=/usr/local/db4
[root@piyush db-4.8.30.NC]# make
[root@piyush db-4.8.30.NC]# make install
After installing DB4, just set the environment variables:-
CPPFLAGS=”-I/usr/local/db4/include”
export CPPFLAGS
LDFLAGS=”-L/usr/local/db4/lib -R/usr/local/db4/lib”
export LDFLAGS
LD_LIBRARY_PATH=/opt/db-4.8.30.NC/build_unix/.libs
export LD_LIBRARY_PATH
Now try to install openldap, hope you will not get any error :-
[root@piyush db-4.8.30.NC]# cd ../openldap-2.4.28
[root@piyush openldap-2.4.28]# ./configure –with-tls=openssl
[root@piyush openldap-2.4.28]# make depend
[root@piyush openldap-2.4.28]# make
[root@piyush openldap-2.4.28]# make test
[root@piyush openldap-2.4.28]# make install
======================================================================
Enjoy Linux !!!