nginx kommt beim Systemstart nicht hoch

ThorstenS

Member
May 21, 2015
18
1
23
~
Hi Leute,

ich habe einen 4.4-94 proxmox-cluster unter jessie, aber der nginx für den reverse proxy kommt nicht automatisch beim Booten hoch:

Code:
journalctl -b -u nginx
-- Logs begin at Mi 2017-08-30 09:06:55 CEST, end at Mi 2017-08-30 12:17:53 CEST. --
Aug 30 09:07:00 proxmox-edu02 systemd[1]: Starting A high performance web server and a reverse proxy server...
Aug 30 09:07:00 proxmox-edu02 nginx[1335]: nginx: [emerg] BIO_new_file("/etc/pve/local/pve-ssl.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/pve/local/pve-ssl.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
Aug 30 09:07:00 proxmox-edu02 nginx[1335]: nginx: configuration file /etc/nginx/nginx.conf test failed
Aug 30 09:07:00 proxmox-edu02 systemd[1]: nginx.service: control process exited, code=exited status=1
Aug 30 09:07:00 proxmox-edu02 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Aug 30 09:07:00 proxmox-edu02 systemd[1]: Unit nginx.service entered failed state.

Er meckert also an, dass er /etc/pve/local/pve-ssl.pem (noch) nicht lesen kann. ich vermute, dass er Webserver zu früh starten will, wenn /etc/pve noch nicht eingebunden ist.

Ergo habe ich /etc/systemd/system/multi-user.target.wants/nginx.service angepaßt und in der Unit After=pvedaemon.service hinzugefügt.
Das hilf aber nicht, der Fehler bleibt. Wie mache ich es richtig?
 
was sagt denn
Code:
systemctl list-dependencies nginx
systemctl show nginx

an und für sich sollte es ausreichen, ein Wants=pve.cluster und After=pve-cluster hinzuzufügen..
 
argh! Danke dir.
systemctl show nginx zeigte keine Abhängigkeit zu pve-cluster oder pve-daemon, obwohl ich es konfiguriert hatte. Dann ist mir aufgefallen, dass die unit natürlich nach /etc/systemd/system gehört und nicht nach /etc/systemd/system/multi-user.target.wants. ein systemctl enable nginx ist ebenfalls sinnvoll.

Meine aktuell funktionierende /etc/systemd/system/nginx.service
Code:
[Unit]
Description=A high performance web server and a reverse proxy server
After=remote-fs.target
After=pve-cluster.service
Wants=pve-cluster.service                                                                                                     

[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid
TimeoutStopSec=5
KillMode=mixed

[Install]
WantedBy=multi-user.target
 
  • Like
Reactions: KevinH
Falls jemand per Suche auf diesen alten Thread stößt - es geht natürlich noch einfacher mit einer override für den nginx. So läuft es hier schonseit Jahren:

INI:
$ cat /etc/systemd/system/nginx.service.d/override.conf
[Unit]
Requires=pve-cluster.service
After=pve-cluster.service
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!