DigitalOcean provides one-click installation of WP, Drupal and CiviCRM. I hope this question can collect experiences with it to help others.

  • What additional considerations are there for hosting CiviCRM on DigitalOcean?
  • Are there any specific configurations or patches required?
  • Is there any functionality which differs from hosting CiviCRM on a "standard" LAMP stack?

I setup Drupal and CiviCRM on my Digital Ocean Droplet by hand, but you'll face this issue regardless of how you setup. This answer is sufficiently long and complex that I'm setting up a complete guide on my wiki.

DO does not allow SMTP traffic on their IPv6 network. As a result, PHP applications that normally succeed in sending email will be unreliable, slow or outright fail. CiviCRM is one that can be especially challenging to configure for outbound email at DO. Although the simple mail() function appears to work, I don't think it offers the control or performance you might need. In my case I wanted to use Google Apps for Business to send my email.

The first thing you need to do is to set your hostname to a fully qualified domain name. When you set your hostname to a FQDN, that will cause the DO system to create a PTR record in DNS for your host. Without a PTR record, many major email providers (Comcast/HotMail/Yahoo) will refuse to talk to your host and those messages will disappear into the void (check /var/log/mail.log). CiviCRM will report those messages as 'sent', but the recipient will never get it, not even in spam, because it never left your server.

You must setup an A record for your FQDN at your DNS provider. The PTR record should be automatically setup by Digital Ocean.

dig foo.example.com
dig -x foo.example.com

Assuming you want to configure CiviCRM to use an external SMTP server such as Google Apps for Business (aka SMTP relay also known as smarthosting) you will suffer connection timeouts. Some apps such as PHPMailer can be made to work with a hack using gethostbyname(), but the configuration for CiviCRM will only allow you to enter the hostname; and no permutation will work. Instead, tell CiviCRM to use 'sendmail'. Meanwhile sendmail is not actually installed. Postfix can be installed as the MTA and you can configure Postfix to send mail to Google. The 'hack' is to also bind Postfix to so that it uses IPv4

With the PTR record in place, and Postfix installed relaying SMTP to your provider over an IPv4 network, and CiviCRM set to use 'sendmail' you can now use your CiviMail.

  • Interesting. We are running on Digital Ocean and don't have any of the mail issues. We use SMTP to a private server. If I remember correctly, we tried using google but because of their limits on how many messages can be sent, we went with the private server, but maybe we had timeout issues as well. For what it's worth that server is running qmail. – Paul-Tahoe Aug 12 '15 at 4:12
  • Paul-Tahoe, it's not clear to me how you setup your DO environment and configured CiviCRM. Are you saying that you have qmail running as the MTA on your droplet, and configured CiviCRM to use qmail in the SMTP options for outbound email settings? Are you also saying that qmail is configured to relay to an external service (such as SendGrid or Dyn)? – Greg Rundlett Aug 13 '15 at 20:47
  • Our droplet doesn't have IPv6 enabled and we are using an an external service so to speak. The external service is really a private server running at a friendly person's house with fiber. Unfortunately, they are moving that server onto shared hosting which won't allow the smtp relaying so we'll have to move to a external service. – Paul-Tahoe Aug 14 '15 at 6:03

I've been running several CiviCRM sites on DigitalOcean for the past year and have been quite happy. I've been using Nginx, MariaDB,and PHP-FPM to serve both WordPress and Drupal instances. While I've never used their one-click installations, they should work just fine assuming you're comfortable working in a Linux environment.

As Greg mentions,you may experience problems if you try to send on a server with IPv6 enabled. IPv6 is given priority over IPv4, so if you want to send from a DigitalOcean server you'll want to considering disabling IPv6 or force your MTA to use IPv4. I've gotten around this at times by using Mandrill for my transaction emails.

I've found services like Mandrill and Sendgrid much more convenient than configuring and maintaining my own mail server. The quotas they offer free users are quite generous so most sites are unlikely to burn through it. There's an extension to take advantage of Mandrill's webhooks that is helpful too.

If you opt to serve CiviCRM using a LEMP stack, you should keep in mind that Nginx doesn't use .htaccess so you'll need to adjust your server block(s) accordingly. I'm beginning to compile sample configurations for deploying CiviCRM with Nginx, but this is very much a work in progress.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.