Binary Cache: Difference between revisions

imported>Milahu
Example: Fetch metadata of bash
imported>Ncfavier
Improve nginx configuration
Line 51: Line 51:
services.nginx = {
services.nginx = {
   enable = true;
   enable = true;
  recommendedProxySettings = true;
   virtualHosts = {
   virtualHosts = {
     # ... existing hosts config etc. ...
     # ... existing hosts config etc. ...
     "binarycache.example.com" = {
     "binarycache.example.com" = {
       serverAliases = [ "binarycache" ];
       serverAliases = [ "binarycache" ];
       locations."/".extraConfig = ''
       locations."/".proxyPass = "http://${config.services.nix-serve.bindAddress}:${toString config.services.nix-serve.port}";
        proxy_pass http://localhost:${toString config.services.nix-serve.port};
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      '';
     };
     };
   };
   };