use lets encrypt certificates and www.* support + fallback vhost
This commit is contained in:
parent
c4551c8fed
commit
0aee3fb1fd
1 changed files with 20 additions and 5 deletions
21
web.nix
21
web.nix
|
|
@ -25,8 +25,15 @@
|
|||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts."default" = {
|
||||
default = true;
|
||||
recommendedTlsSettings = true;
|
||||
recommendedProxySettings = true;
|
||||
recommendedGzipSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
|
||||
virtualHosts."cordevelop.com" = {
|
||||
serverAliases = [ "www.cordevelop.com" ];
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
root = "/var/www/html";
|
||||
locations."/".index = "index.php index.html";
|
||||
locations."~ \\.php$".extraConfig = ''
|
||||
|
|
@ -35,7 +42,15 @@
|
|||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
'';
|
||||
};
|
||||
|
||||
# Anything else (bare IP, unknown names) gets no content and no certificate
|
||||
virtualHosts."_" = {
|
||||
default = true;
|
||||
rejectSSL = true;
|
||||
locations."/".return = "444";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# database "app" and a MySQL user "web" that logs in via the local socket (no password)
|
||||
services.mysql = {
|
||||
|
|
@ -46,5 +61,5 @@
|
|||
}];
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue