As discussed in [1], there is a bug in nginx [2] which makes Ubuntu's systemd unit restarts fail when nginx is litening on a unix domain socket. This happens because nginx fails to remove the socket during its shutdown process.
This issue has been reported in Debian in [3], and has been fixed upstream since 1.19.1, with the following patch: [4].
To reproduce the issue, run the following commands from a jammy machine:
As discussed in [1], there is a bug in nginx [2] which makes Ubuntu's systemd unit restarts fail when nginx is litening on a unix domain socket. This happens because nginx fails to remove the socket during its shutdown process.
This issue has been reported in Debian in [3], and has been fixed upstream since 1.19.1, with the following patch: [4].
To reproduce the issue, run the following commands from a jammy machine:
# apt install -y nginx files/hello files.socket serve-files. socket;
# systemctl stop nginx
# mkdir -p /var/www/files
# echo hello > /var/www/
# cat << EOF > /run/serve-
server {
listen unix:/run/
root /var/www/files;
location / {
try_files $uri =404;
}
}
EOF
# systemctl start nginx
Verify it works with:
# echo -e "GET /hello HTTP/1.0\r\n" | netcat -U /run/serve- files.socket
And restart the service:
# systemctl restart nginx
This will throw an error and the service will end in a failed state.
Verify that the socket file in /run/serve- files.socket was not removed.
Removing the socket file should allow you to restart the service.
[1] https:/ /bugs.launchpad .net/ubuntu/ +source/ nginx/+ bug/1919965 /trac.nginx. org/nginx/ ticket/ 753 /bugs.debian. org/cgi- bin/bugreport. cgi?bug= 821111 hg.nginx. org/nginx/ rev/7cbf6389194 b
[2] https:/
[3] https:/
[4] http://