Nixos

如何在 Nixos 的 Apache 服務配置中啟用 PHP?

  • March 21, 2019

我正在使用以下配置:

services.httpd =
 {
   enable = true;
   adminAddr = "localhost";

   extraModules =
   [
     "http2" 
   ];
   enablePHP = true;

   virtualHosts =
   [
     {
       hostName = "localhost";
       documentRoot = "/var/www/html/html-geo";
       serverAliases =
       [
         "localhost"
       ];
       enableSSL = false;
     }
   ];
 };

 users.users.http =
 {
   isNormalUser = true;
   home = "/etc/user/http";
 };

但是,這會導致以下錯誤:

3 月 21 日 15:23:44 nixos httpd

$$ 21707 $$:httpd:/nix/store/dp6kc224raib72dk8g2lahrr3a1drk8j-httpd.conf 第 69 行的語法錯誤:無法載入 /nix/store/bp2jirc0zwa46rb3xm62xjc8bsvknavc-apache-httpd-2.4.35/modul>

 {name = "php7"; path = "${pkgs.php}/modules/libphp7.so";}

我需要將以上內容添加到extraModules.

引用自:https://unix.stackexchange.com/questions/507746