VirtualminWeb Development

Install Sendy on Ubuntu 16.04 VPS with Virtualmin & Nginx

Sendy can be used to send bulk emails/newsletters to your lists for a fraction of the cost of other providers. This tutorial will show you how to install Sendy on VPS with Virtualmin control panel and nginx web server for maximum performance.

Requirement to Install Sendy on VPS

Sendy is a self hosted software, which means you need hosting space to run it. You can install it on shared hosting, but it will be unstable. Instead you can get a 1GB RAM cloud VPS from one of the leading providers and follow this tutorial to install Sendy on VPS with Virtualmin control panel. The costs will be the same and you’ll get a stable installation of Sendy.

Before you install sendy on VPS, you need to install Virtualmin and nginx on it and create a virtual server within Virtualmin for your Sendy domain or sub domain. After you’re done all those things, you can follow below instructions to install Sendy on newly created virtual server.

Install Sendy Having trouble setting up Sendy? Or just have better things to do?
Why not hire me to install it for you?

Get Sendy Installed

Upload Sendy to the Server

Start by extracting Sendy installation package to a local folder. You’ll find installation files inside the sendy directory. Everything in this folder should be uploaded to the public_html directory on the virtual server you created for your domain. You can use FileZilla to upload files to your server. Make sure to use the administrative username for the domain when connecting with FileZilla.

Prepare Sendy for Installation

Once everything is uploaded, login to your VPS as administrative user of the domain over SSH and open config.php with nano text editor.

nano /home/AdminUserName/public_html/includes/config.php

Search for following line and replace your_sendy_installation_url with your domain name.

define('APP_PATH', 'http://your_sendy_installation_url');

Then search for following lines and add database credentials within apostrophe marks.

	$dbHost = ''; //MySQL Hostname
	$dbUser = ''; //MySQL Username
	$dbPass = ''; //MySQL Password
	$dbName = ''; //MySQL Database Name

Close the file. Now change permissions of the uploads directory to 777.

chmod -R 777 /home/AdminUserName/public_html/uploads

Add nginx Rewrite Rules for Sendy

Since we’re using nginx as the web server, special rewrite rules for Sendy needs to be added to nginx virtual host file. So logout from the administrative user account and login as root user with putty. Open virtual host file for the domain with nano text editor. Replace example.com with your domain or sub domain.

nano /etc/nginx/sites-available/example.com.conf

Search for following line,

fastcgi_param HTTPS $https;

And paste following rules below it in a new line.

    location = / {
        index index.php;
}

location / {
        if (!-f $request_filename){
                rewrite ^/([a-zA-Z0-9-]+)$ /$1.php last;
        }
}

location /l/ {
        rewrite ^/l/([a-zA-Z0-9/]+)$ /l.php?i=$1 last;
}

location /t/ {
        rewrite ^/t/([a-zA-Z0-9/]+)$ /t.php?i=$1 last;
}

location /w/ {
        rewrite ^/w/([a-zA-Z0-9/]+)$ /w.php?i=$1 last;
}

location /unsubscribe/ {
        rewrite ^/unsubscribe/(.*)$ /unsubscribe.php?i=$1 last;
}

location /subscribe/ {
        rewrite ^/subscribe/(.*)$ /subscribe.php?i=$1 last;
}

location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
        expires max;
        log_not_found off;
}

Close the file and restart nginx.

systemctl restart nginx.service

Install Sendy

If you’ve done everything as instructed, Sendy is now ready to be installed. You can run Sendy compatibility check script at following URL.

http://example.com/_compatibility.php?i=1

If you have 8/9 score, you have everything Sendy needs on your server.

The 8/9 score is due to mod_rewrite is being disabled. mod_rewrite is an Apache module and therefore not enabled on your server. Since you’ve already added nginx rewrite rules to the server, mod_rewrite is not required to run Sendy. The compatibility check script only check for availability of mod_rewrite. Sendy will run normally without it.

Now open your domain name on browser. You’ll see a page similar to this image.
install sendy on VPS

Follow the instructions on that page to complete the Sendy installation. Once you do that Sendy installation is complete for the most part. But Sendy require Cron jobs set up for campaign scheduling and autoresponders.

Setup Sendy Cron Jobs

There are two cron jobs to be setup. One for campaign scheduling and one for autoresponders. You can use Virtualmin to setup cron jobs. Settings can be found at Webmin > System > Scheduled Cron Jobs. But I find it easier to do it from command line. So login to your server as root user and issue following command.

crontab -e

Since you’re opening crontab for the first time, it’ll ask you which editor to use. Select nano text editor. Crontab will open and you’ll see few Virtualmin related cron jobs. Add following commands at the end of the file.

*/5 * * * * php /home/AdminUserName/public_html/scheduled.php > /dev/null 2>&1
*/1 * * * *  php /home/AdminUserName/public_html/autoresponders.php > /dev/null 2>&1

Replace AdminUserName with your Sendy server admin username. Save and close file. You Sendy is now ready to use.

If you have issues with these instructions or the installation create a topic on server administration forum.

Tags

Tharindu

Hey!! I'm Tharindu. I'm from Sri Lanka. I'm a part time freelancer and this is my blog where I write about everything I think might be useful to readers. If you read a tutorial here and want to hire me, contact me here.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Close