Setting up Sendy with Nginx

Purchase a copy of Sendy here and download the package.

Upload the package to your server and unzip it into a directory, for example, "sendy".

Edit includes/config.php make sure all the necessary fields are set. Such as:

define('APP_PATH', 'https://your_domain.com');
$dbHost = 'my_db_host'; //MySQL Hostname
$dbUser = 'my_user'; //MySQL Username
$dbPass = 'my_password'; //MySQL Password
$dbName = 'my_sendy_db'; //MySQL Database Name
$dbPort = 3306; //MySQL Port

Create uploads directory if it does not exists and set the permission to 777.

mkdir uploads
chmod 777 ./uploads

Install your nginx server and php packages.

sudo apt-get install nginx-full php-fpm php-mysql

Now you need to setup nginx to server sendy. Create the following server blocks:

server {
        listen 80;
        listen [::]:80;
        server_name your_domain.com;
        return 301 https://$host$request_uri;
}
server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;

        root /home/username/sendy;
        index index.php index.html;

        server_name your_domain.com;

        ssl on;
        ssl_certificate /path/to/cert.pem;
        ssl_certificate_key /path/to/key.pem;

        autoindex off;

        location / {
                index index.php index.html;
                try_files $uri $uri/ $uri.php?$args;
        }
        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 ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
        }

}

Restart your nginx server. Then visit your_domain.com and continue with the instruction to complete the setup. If you encounter any problem with the setup, visit your_domain.com/_compatibility.php?i=1 to check if all necessary requirements are met.

To setup the background processing, you need to add this line to crontab.

*/3 * * * * /usr/bin/php5 /home/username/sendy/scheduled.php > /dev/null 2>&1

Finally, if you are using Amazon SES to send the newsletter, config the IAM credential. It needs to have AmazonSESFullAccess and AmazonSNSFullAccess privilege.


AI Summary
Chrome On-device AI 2024-10-04 23:04:13

Share Article