Skip to content

nixos/acme: nginx configuration test fails during nixos-rebuild switch when you have an existing virtualhost and add a new one #60180

@arianvp

Description

@arianvp

Issue description

nginx failed to restart after I added a second virtualHost to my nginx config.
running nixos-rebuild switch a second time fixed the issue. But my website went down due to a nixos-rebuild switch which seems like there is a serious bug in the enableACME logic in the nginx module

Friends of me also ran into this multiple times last week at their company

Steps to reproduce

  1. Have a virtualHost with enableACME = true
  2. Add an extra virtualHost with enableACME = true and nixos-rebuild switch
  3. The nginx prestart script (nginx -t) fails

This was the specific commit that failed to deploy: arianvp/nixos-stuff@4fe0a77

Logs:

Apr 24 14:27:56 arianvp.me systemd[1]: nginx.service: Current command vanished from the unit file, execution of the command list won't be resumed.
Apr 24 14:27:56 arianvp.me systemd[1]: Stopping Nginx Web Server...
-- Subject: Unit nginx.service has begun shutting down
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nginx.service has begun shutting down.
Apr 24 14:27:56 arianvp.me systemd[1]: Stopped Nginx Web Server.
-- Subject: Unit nginx.service has finished shutting down
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nginx.service has finished shutting down.
Apr 24 14:27:56 arianvp.me systemd[1]: Starting Nginx Web Server...
-- Subject: Unit nginx.service has begun start-up
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nginx.service has begun starting up.
Apr 24 14:27:56 arianvp.me s0966gsjr6cilylnniqzh5l35z99jyng-unit-script-nginx-pre-start[18364]: nginx: [emerg] BIO_new_file("/var/lib/acme/techstock.photos/fullchain.pem") fai>
Apr 24 14:27:56 arianvp.me s0966gsjr6cilylnniqzh5l35z99jyng-unit-script-nginx-pre-start[18364]: nginx: configuration file /nix/store/5g561hwc1lw3bbc29qdr83fwl5iykjnv-nginx.con>
Apr 24 14:27:56 arianvp.me systemd[1]: nginx.service: Control process exited, code=exited status=1
Apr 24 14:27:56 arianvp.me systemd[1]: nginx.service: Failed with result 'exit-code'.
Apr 24 14:27:56 arianvp.me systemd[1]: Failed to start Nginx Web Server.
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nginx.service has failed.
-- 
-- The result is RESULT.

Technical details

Nixos 19.03 but also happened on 18.03 to me in the past

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions