27 Feb

ProFTPd server IP address binding on Centos 5.9

By default ProFTPd server on Centos 5.9 tries to resolve current hostname to get IP address to bind. So if it fails if you hostname doesn’t resolve. To make it listen the socket on your IP add this line to your configuration file:


It will do the trick. Just change it to your actual IP.

17 Feb

How to put Apache web site into the maintenance mode

This is how you can add put you webisite working under Apache web server into the maintenance mode. Note that you need to have mod_rewrite enabled.

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{REQUEST_FILENAME} !/maintenance.html
RewriteRule ^.*$ /maintenance.html [L]

If the page maintenance.html exists all requests will be rewritten to it.

05 Feb

How to disable versions expose in PHP and webservers (nginx, Apache)

By default PHP exposes it’s version:

curl -vi localhost
< HTTP/1.1 200 OK
< Server: nginx/1.0.15
< Date: Fri, 01 Feb 2013 23:19:48 GMT
< Content-Type: text/html
< Transfer-Encoding: chunked
< Connection: keep-alive
< Keep-Alive: timeout=64
< X-Powered-By: PHP/5.4.8

As you can see just by running GET requst you are able to get nginx and PHP version on the server:

Server: nginx/1.0.15
X-Powered-By: PHP/5.4.8

To disable it modify your /etc/php.ini file:

expose_php = Off

As well as nginx’ http section:

server_tokens off;

And if you use Apache:

ServerTokens Prod