Skip to content

Instantly share code, notes, and snippets.

@disassembler
Created August 30, 2017 21:02
Show Gist options
  • Save disassembler/b33545f986a56101e0d5ced98d410e5f to your computer and use it in GitHub Desktop.
Save disassembler/b33545f986a56101e0d5ced98d410e5f to your computer and use it in GitHub Desktop.
{
services.caddy = {
enable = true;
email = "sam@barbaz.com";
agree = true;
config =
''
nixos.barbaz.com {
root /data/web/example/public
gzip
fastcgi / 127.0.0.1:9000 php
rewrite {
regexp .*
to {path} {path}/ /index.php?_url={uri}
}
}
foobar.com, www.foobar.com {
root /data/web/vhosts/foobar/prod/public
gzip
fastcgi / 127.0.0.1:9000 php
rewrite {
regexp .*
to {path} {path}/ /index.php?_url={uri}
}
}
staging.foobar.com {
root /data/web/vhosts/foobar/staging/public/wp
gzip
fastcgi / 127.0.0.1:9000 php
rewrite {
to {path} {path}/ /index.php?_url={uri}
}
}
#dyndns.foobaz.net {
# root /data/web/vhosts/foobaz/dyndns
# gzip
# fastcgi / 127.0.0.1:9000 php
# basicauth /data/web/vhosts/foobaz/dyndns dyndns bp6mRhapgZeL
#}
#foobaz.net, www.foobaz.net {
# root /data/web/vhosts/foobaz/htdocs
# gzip
#}
util.barbaz.com {
root /data/web/vhosts/barbaz/util
gzip
fastcgi / 127.0.0.1:9000 php
}
www.barbaz.com, barbaz.com {
root /data/web/vhosts/barbaz/drupal/web
gzip
fastcgi / 127.0.0.1:9000 php
rewrite {
to {path} {path}/ /index.php?q={uri}
}
}
resume.foobarbaz.us, www.foobarbaz.us, foobarbaz.us, resume.barbaz.com {
root /data/web/vhosts/barbaz/resume
gzip
}
'';
};
services.mysql = {
enable = true;
package = pkgs.mariadb;
};
services.phpfpm = {
phpPackage = pkgs.php71;
poolConfigs = {
mypool = ''
listen = 127.0.0.1:9000
user = caddy
pm = dynamic
pm.max_children = 5
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 2
pm.max_requests = 50
'';
};
phpOptions =
''
[opcache]
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
'';
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment