Skip to content

Instantly share code, notes, and snippets.

@Lemmings19
Last active February 2, 2019 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lemmings19/cbee05b6cec0ec8dacb1144e6cf15d6a to your computer and use it in GitHub Desktop.
Save Lemmings19/cbee05b6cec0ec8dacb1144e6cf15d6a to your computer and use it in GitHub Desktop.
Sendy Nginx Configuration 2018-07-11

Installing Sendy at https://mydomain.com/sendy, this worked for me:

Add this into your existing site configuration found at /etc/nginx/sites-available/mydomain.com:

    location /sendy {
        # covers /l, /t, and /w URLs.
        rewrite ^/sendy/(l|t|w)/([a-zA-Z0-9\/]+)$ /sendy/$1.php?i=$2&$args;
        # covers /subscribe and /unsubscribe URLs.
        rewrite ^/sendy/(u?n?subscribe)/(.*)$ /sendy/$1.php?i=$2&$args;
        # This is an Nginx equivalent for Apache's mod_rewrite.
        try_files $uri $uri/ $uri.php?$args;

        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            # If this IP doesn't work, try looking around the rest of your mydomain.com Nginx config and copy what you find set for other fastcgi_pass configurations.
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    }

If you're having issues, check https://mydomain.com/sendy/_compatibility.php?i=1 to see if anything isn't configured properly. mod_rewrite is not enabled will probably always show up if you're using Nginx.

@bbrendon
Copy link

I think a more complete solution would be to add this inside the location block

        root /usr/local/share;
        index index.php;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment