nixbld: optimize web server settings

This commit is contained in:
Sebastien Bourdeauducq 2019-07-27 11:27:28 +08:00
parent 049ef39c29
commit 820ede4ac3
1 changed files with 10 additions and 0 deletions

View File

@ -252,6 +252,7 @@ ACTION=="add", SUBSYSTEM=="tty", \
services.nginx = { services.nginx = {
enable = true; enable = true;
recommendedProxySettings = true; recommendedProxySettings = true;
recommendedGzipSettings = true;
virtualHosts = let virtualHosts = let
mainWebsite = { mainWebsite = {
addSSL = true; addSSL = true;
@ -260,8 +261,17 @@ ACTION=="add", SUBSYSTEM=="tty", \
extraConfig = '' extraConfig = ''
error_page 404 /404.html; error_page 404 /404.html;
''; '';
locations."^~ /fonts/".extraConfig = ''
expires 60d;
'';
locations."^~ /js/".extraConfig = ''
expires 60d;
'';
locations."/MathJax" = { locations."/MathJax" = {
alias = "/var/www/MathJax"; alias = "/var/www/MathJax";
extraConfig = ''
expires 60d;
'';
}; };
# legacy URLs, redirect to avoid breaking people's bookmarks # legacy URLs, redirect to avoid breaking people's bookmarks