Monthly Archives: November 2015

force ssl on nginx

server {
    listen      80;
    rewrite     ^   https://$server_name$request_uri? permanent;

Free up cache memory

free && sync && echo 3 > /proc/sys/vm/drop_caches && free

Exim to mandrilapp

If you have ever tried to send emails from your dedicated server in the cloud to either a mailing list or to individual users of your site, you would know that it is not as simple as it sounds. Depending upon the reputation of the IP address asigned to your server, many large email providers might block your emails – even though you have a perfectly legitimate reason to send this email, and your company has never spammed anyone. The solution we implemented was subscribing to the excellent Mandrill transactional email server from and sending all our emails via them. The problem then is how to makes sure all your emails as routed (relayed) through them? For your Drupal emails, you can use the Mandrill module, but that covers only Drupal (and has other issues). So what we really did was route emails to Mandrill at SMTP MTA (Mail Transport Agent) configuration level itself. The rest of the article describes how.

We use Debian Linux, which uses exim4 as the default MTA. To reconfigure it, just run sudo dpkg-reconfigure exim4-config, and follow the screens. You can take the defaults, except in the following three cases:

  • Type of mail configuration – mail sent by smarthost; no local mail
  • System mail name – (or whatever your primary domain name is)
  • IP address or host name of the outgoing smarthost – (this is most important)

Exim4 - Type of mail configuration

Exim4 - System mail name

Exim4 - Outgoing smarthost

Exit the configuration program and then there is one more VERY IMPORTANT thing. You must edit /etc/exim4/passwd.client file (as root or using sudo) and add the following line to it:


You can find your Mandrill API from after logging in.

That’s it. Now all emails going out of your server will be relayed through Mandrill, and thus (hopefully) not rejected by your recepient’s email providers. Happy emailing!

All Credits are for –