Skip to content

Instantly share code, notes, and snippets.

@tucq88
Last active August 14, 2020 09: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 tucq88/3c3ecacfd94322a541bd58a2cb816063 to your computer and use it in GitHub Desktop.
Save tucq88/3c3ecacfd94322a541bd58a2cb816063 to your computer and use it in GitHub Desktop.
Nginx config for Sendy. With Ubuntu@18.04, php@7.3, nginx@1.14.0
# sudo crontab -e
*/1 * * * * php /var/www/html/sendy//import-csv.php > /dev/null 2>&1
*/5 * * * * php /var/www/html/sendy//scheduled.php > /dev/null 2>&1
*/1 * * * * php /var/www/html/sendy//autoresponders.php > /dev/null 2>&1
# /etc/mysql/my.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
sql_mode = "STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
server {
root /var/www/html/sendy;
index index.php index.html index.htm;
server_name example.com;
autoindex off;
add_header X-Robots-Tag "noindex, noarchive";
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~ /\. { deny all; log_not_found off; access_log off; return 404; }
location / {
try_files $uri $uri/ /$uri.php$is_args$args; # $is_args converts to a ? if true
}
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 /confirm/ {
rewrite ^/confirm/(.*)$ /confirm.php?i=$1 last;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 30d;
}
}
server {
if ($host = example.com) {
return 301 https://$host$request_uri;
}
listen 80;
server_name example.com;
return 404;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment