DEV Community

AJAY SHRESTHA
AJAY SHRESTHA

Posted on • Edited on

Deploy Sendy on AWS EC2 with Apache in Ubuntu

To begin, you'll need an AWS account and lunch EC2 instance with your specific requirement. I have used AWS EC2 t4g.small instance with Ubuntu OS, as it provides a balance between computing power and cost-efficiency, making it ideal for hosting applications like Sendy.

Installing Necessary Software
Connect to your instance via SSH, proceed with the environment setup. Update your server's package index and install the necessary software packages:

sudo apt update
sudo apt install mysql-server apache2
sudo apt install php-fpm php-mysql php-xml php-mbstring
Enter fullscreen mode Exit fullscreen mode

These commands install MySQL for database management, Apache2 for serving your application, and PHP along with essential extensions that Sendy requires to function properly.

Configuring MySQL
create a database and user for Sendy

sudo mysql
Enter fullscreen mode Exit fullscreen mode
CREATE DATABASE sendy_db CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'sendy_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON sendy_db.* TO 'sendy_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Enter fullscreen mode Exit fullscreen mode

Replace, sendy_db with your actual database name, sendy_user with your actual database user and password with your password

Uploading and Configuring Sendy
Upload Sendy's files to your server, typically in the /var/www/sendy directory.
Update /var/www/sendy/includes/config.php for configuring database and domain in sendy

sudo vi /var/www/sendy/includes/config.php
Enter fullscreen mode Exit fullscreen mode
define('APP_PATH', 'https://domain_name.com'); // Domain
$dbHost = ''; //MySQL Hostname
$dbUser = ''; //MySQL Username
$dbPass = ''; //MySQL Password
$dbName = ''; //MySQL Database Name
Enter fullscreen mode Exit fullscreen mode

Configuring Apache
Set up a virtual host for Sendy in Apache:

sudo vi /etc/apache2/sites-available/sendy.conf
Enter fullscreen mode Exit fullscreen mode
<VirtualHost *:80>
    ServerName domain_name.com   // Use Sendy Hosting Domain
    DocumentRoot /var/www/sendy

    <Directory /var/www/sendy>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enter fullscreen mode Exit fullscreen mode

Enable the site and necessary modules, then restart Apache and PHP to apply the changes:

sudo a2ensite sendy.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo systemctl restart php8.1-fpm
Enter fullscreen mode Exit fullscreen mode

Securing Your Server with SSL
Install Certbot and set up an SSL certificate to secure your Sendy installation:

sudo apt-get install certbot python3-certbot-apache
sudo certbot --apache
Enter fullscreen mode Exit fullscreen mode

Installing Sendy
Navigate to https://domain_name.com/install.php to run the Sendy installer. Follow the on-screen instructions to complete the setup.

Enable Cronjob
Set up a Cron job to handle scheduled tasks:

sudo crontab -u www-data -e
Enter fullscreen mode Exit fullscreen mode

Add Line below

*/5 * * * * /usr/bin/curl -s http://domain_name/scheduled.php > /dev/null 2>&1
Enter fullscreen mode Exit fullscreen mode
sudo systemctl reload cron
Enter fullscreen mode Exit fullscreen mode

Please note that Sendy is not officially tested on Nginx. Sendy is only officially supported and tested on Apache.

Top comments (1)

Collapse
 
sushektamrakar profile image
Sushek

SENDY especially use for send newsletter or blog notification email.