Snippet #2388 (by symphorien, python)

  • #2388
Expires in: 0 minutes View Raw
  1. { config, lib, pkgs, ... }:
  2. let
  3.  xok = pkgs.stdenv.mkDerivation {
  4.    name = "php-root";
  5.    buildCommand = ''
  6.      mkdir $out;
  7.      echo ' <?php phpinfo(); ?>' > $out/index.php;
  8.    '';
  9.  };
  10.  cfg = config.services.nginx;
  11. in
  12.  {
  13.    services.nginx = {
  14.      enable = true;
  15.      virtualHosts."default" = {
  16.        root = "/data/webserver";
  17.        default = true;
  18.        extraConfig = ''
  19.              location ~ \.php$ {
  20.                document_root ${xok};
  21.                include ${cfg.package}/conf/fastcgi_params
  22.                fastcgi_pass  127.0.0.1:9000;
  23.                fastcgi_index index.php;
  24.                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  25.              }
  26.        '';
  27.      };
  28.    };
  29.  
  30.  }

Reply to this snippet →

Honeypot, don't fill.
⌘+⏎ or Ctrl+⏎