Mediawiki, httpd.conf ServerName empty, httpd service fails

I have made a configuration for services.mediawiki but when I run nixos-rebuild switch, the httpd service fails because ServerName is listed in httpd.conf, but it doesn’t have an address to go with it. I cannot figure out how to either remove the unused ServerName.

/etc/httpd/httpd.conf

ServerRoot /nix/store/rbkdwyxp8qwlnxs25agv027y1sbjm5l1-apache-httpd-2.4.54
ServerName
DefaultRuntimeDir /run/httpd/runtime

PidFile /run/httpd/httpd.pid

# mod_cgid requires this.
ScriptSock /run/httpd/cgisock


<IfModule prefork.c>
    MaxClients           150
    MaxRequestsPerChild  0
</IfModule>

Listen *:443 https
Listen *:80 http

User wwwrun
Group wwwrun

...

/etc/nixos/mediawiki.nix

{ config, pkgs, ... }:

{

  services.httpd.enable = true;

  services.mediawiki.enable = true;
  services.mediawiki.passwordFile = pkgs.writeText "password" ''**********'';
  services.mediawiki.virtualHost = 
  {
    hostName = "****.duckdns.org";
    adminAddr = "****";
    addSSL = true;
    sslServerCert = "/run/keys/mediawiki/self-signed.cert";
    sslServerKey = "/run/keys/mediawiki/self-signed.key";
  };

}

Any help would be appreciated.

1 Like

According to nixpkgs/default.nix at 170e39462b516bd1475ce9184f7bb93106d27c59 · NixOS/nixpkgs · GitHub you need to set networking.hostName in your configuration.

1 Like

That worked. Thanks very much.

1 Like