Skip to content

Instantly share code, notes, and snippets.

@udovicic
Created January 15, 2015 08:57
Show Gist options
  • Save udovicic/57b053a7bb6a43082b06 to your computer and use it in GitHub Desktop.
Save udovicic/57b053a7bb6a43082b06 to your computer and use it in GitHub Desktop.
nginx configuration for Sendy
upstream sendybackend {
server unix:/var/run/php-fcgi-sendy.sock;
}
server{
listen {server_ip}:80;
server_name sendy.{domain};
autoindex off;
index index.php index.html;
root {path to files};
error_log /var/log/nginx/sendy.error.log;
access_log /var/log/nginx/sendy.access.log;
location / {
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 /templates/ {
rewrite ^/templates/(.*)$ /templates.php?i=$1 break;
}
location /template_create/ {
rewrite ^/template_create/(.*)$ /template_create.php?i=$1 break;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass sendybackend;
fastcgi_index index.php;
include fastcgi_params;
}
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 30d;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment