Home / Web Development / Virtualmin / How to Install Sendy on a VPS with Virtualmin & Nginx

How to Install Sendy on a 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 it on an unmanaged VPS with Virtualmin control panel and nginx web server for maximum performance.

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 it with Virtualmin control panel. The costs will be the same and you’ll get a stable installation of Sendy.

Before you begin installing sendy on your 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.

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 on 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 Rule 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 nano /etc/nginx/sites-available/example.com

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.
sendy-install-page

Follow the instructions on that page to complete the Sendy installation. If you have issues with these instructions or the installation create a topic on server administration forum.

namecheap namecheap

About Tharindu Kumara

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. send me a message on Fiverr.

Leave a Reply