# Nginx does not restart when working with ssl

**URL:** <https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916>\
**Category:** Web\
**Created:** [December 5, 2024, 8:57pm UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916 "2024-12-05T20:57:59Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [December 5, 2024, 8:57pm UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916/1 "2024-12-05T20:57:59Z")

</div>

Hello.

I noticed a problem that when issuing a ssl certificate, nginx does not restart. The scripts contain a command to restart it. Therefore, the certificate is not issued and does not pass verification.

The panel version is 1.9 beta1  
What can you suggest about this? The debug did not give anything.

---

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [December 5, 2024, 9:15pm UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916/2 "2024-12-05T21:15:06Z")

</div>

I also noticed that when I check the HTTPS redirect box, the redirect does not turn on. Until I restart nginx myself - service nginx restart

Who knows what the problem might be?

---

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [December 5, 2024, 9:30pm UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916/3 "2024-12-05T21:30:06Z")

</div>

When requesting a certificate, .well-known/acme-challenge is created

But after that, nginx does not restart. Therefore, this value is not applied and the certificate cannot be issued. How can this problem be solved?

---

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [December 5, 2024, 9:38pm UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916/4 "2024-12-05T21:38:04Z")

</div>

@eris

---

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [December 5, 2024, 9:43pm UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916/5 "2024-12-05T21:43:25Z")

</div>

v-restart-service nginx - Doesn’t restart nginx at all

But v-restart-service apache2 works fine

nginx -t  
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok  
nginx: configuration file /etc/nginx/nginx.conf test is successful

I don’t understand what’s wrong and where the problem is.

---

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [December 5, 2024, 10:36pm UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916/6 "2024-12-05T22:36:56Z")

</div>

I’ve already racked my brains… I can’t understand why this is so

```
            if [-z "$mail"]; then
                    if ["$WEB_SYSTEM" = 'nginx'] || ["$PROXY_SYSTEM" = 'nginx']; then
                            conf="$HOMEDIR/$user/conf/web/$domain/nginx.conf_letsencrypt"
                            sconf="$HOMEDIR/$user/conf/web/$domain/nginx.ssl.conf_letsencrypt"
                            echo 'location ~ "^/\.well-known/acme-challenge/([-_A-Za-z0-9]+)$" {' \
                                    > $conf
                            echo ' default_type text/plain;' >> $conf
                            echo ' return 200 "$1.'$THUMB'";' >> $conf
                            echo '}' >> $conf
                            if [! -e "$sconf"]; then
                                    ln -s "$conf" "$sconf"
                            fi
                            if [-n "$PROXY_SYSTEM"]; then
                                    $BIN/v-restart-proxy
                                    check_result $? "Proxy restart failed" > /dev/null
                            fi
                    else

```

It seems that everything is in v-add-letsencrypt-domain

But for some reason v-restart-proxy nginx does not work

This is visible from the service uptime via the panel. If you restart manually, everything is fine. Uptime is 0 right away

Can anyone help me? I don’t know what to do anymore.

---

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [December 5, 2024, 11:05pm UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916/7 "2024-12-05T23:05:43Z")

</div>

I solved the problem. The same bug in version 1.8.12

Commented out the parameter in v-restart-service:

```
           systemctl reload-or-restart "$service" >> $log 2>&1
   else

```

And the certificate began to be issued correctly right away. The https redirect was also installed.

Dear developers, Please pay attention to this bug.  
nginx version: nginx/1.27.3  
Debian 12  
1.9-beta1 or 1.8.2

systemctl --version  
systemd 252 (252.31-1~deb12u1)  
+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -BPF\_FRAMEWORK -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [December 6, 2024, 8:27am UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916/8 "2024-12-06T08:27:45Z")

</div>

It doesn’t need to restart as we run:

```auto
service nginx upgrade

```

But this doesn’t replay the redirects,…

---

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [December 6, 2024, 12:06pm UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916/9 "2024-12-06T12:06:45Z")

</div>

For some reason the panel doesn’t do this.

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [December 6, 2024, 1:21pm UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916/10 "2024-12-06T13:21:01Z")

</div>

I have seen it before where the max open files limits caused Nginx not reloading properly. Wonder if this is the case here…

---

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [December 6, 2024, 2:59pm UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916/11 "2024-12-06T14:59:09Z")

</div>

But the thing is that there are no errors. When I did what I wrote, everything worked fine. I think it’s a bug. You need to change the code.

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [December 6, 2024, 3:00pm UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916/12 "2024-12-06T15:00:00Z")

</div>

That is why I think it happens \>\> $log 2\>&1 mutes any output

---

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [December 6, 2024, 3:06pm UTC](https://forum.hestiacp.com/t/nginx-does-not-restart-when-working-with-ssl/16916/13 "2024-12-06T15:06:24Z")

</div>

You can test it yourself. I noticed this bug on all servers. Even in version 1.8.12

There are many problems. But as far as I understand, no one wants to fix them)
