Oct 29

 Sending emails is easy. All you need is access to an SMTP server. Or local Sendmail daemon. Installing and configuring either of the two is a massive task. Even if you get it right, your ISP might not like you running SMTP server. If you are past ISP hurdle, chances are your emails will get marked as SPAM for lack of Reverse DNS.

This is an easier way and we all know it – just use Google SMTP server. All you need is a gmail account or Google Apps account – and who doesn’t have a google account?

However, sometimes, the third party software you’re trying to configure to send emails doesn’t support anything other than localhost. Or it does but wants plain SMTP whereas Google does only TLS. Or simply, connecting to Google’s SMTP for each email takes few seconds and you want faster response.

Here’s a simple solution:

  • Install the wonderful Email Relay program from here
  • Create a file :
    vi /etc/google.email.auth

    and add following line: 

    • login client yourgoogleemailid@gmail.com yourgooglepassword
  • chown daemon:root /etc/google.email.auth
    chmod 400 /etc/google.email.auth
  • run emailrelay as:   
    emailrelay --as-proxy smtp.gmail.com:587 --client-tls --client-auth /etc/google.email.auth
  • Configure your software to use localhost for SMTP server (Port defaulted to 25).

Test your Local Emailer. If it doesn’t work, enable logging in /etc/emailrelay.conf by uncommenting verbose line and look into your syslog file (/var/log/syslog)

Tagged with:
Jun 12

The usual and perhaps recommended way to run wordpress behind nginx is via nginx and fast-cgi. You can easily find these articles on google. However, that’s quite a complex setup and it far easier to just run apache2 + php + wordpress behind nginx and use nginx as a proxy. It’s probably a waste of memory to run the monstrous apache along with nginx but it’s much simpler setup and between my time and computer memory, my time is far more expensive!

Just install wordpress following their usual instructions, then change the apache port to something other than 80 (since nginx is running on 80). Following example assumes apache running at 800.

Then, add following to your nginx conf:

server {
  listen   80;
  server_name  your.blogserver.com;
  location / {
    proxy_pass http://localhost:800;
    proxy_set_header Host $host;
  }
}

Restart your nginx and http://your.blogserver.com should now be your wordpress blog.

Pay special attention to proxy_set_header directive. It took me a while to figure out why wordpress was redirecting itself to ‘localhost’ !!!

Also, the apache config must have DirectoryIndex index.php set.

Tagged with:
preload preload preload