Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Main GUI NGINX crash. Any smart way to re-start it with a script?

Featured Replies

Occasionally the main GUI nginx instance crashes.

 

I'd like to know if anyone has a solution for this. 

 

Is there a script I can run to detect a crash and re-start the main GUI NGINX?

 

Other services are always working but no access to server.

 

I currently keep SSH turned off.

 

Currently new server build has no soft power button on my server to initiate a restart. Although have now bought one on amazon.

 

761642581_Screenshot2024-04-19at18_43_55.thumb.png.6856e9196d3ea7ab37f04e9eeceb71b5.png

Edited by dopeytree

  • Author

Ok here's a user script.

 

#!/bin/bash

NGINX_LOG="/var/log/nginx/error.log"

# Monitor NGINX error log for specific error messages
tail -n0 -F ${NGINX_LOG} | while read LINE; do
    if echo $LINE | grep -q "504 Gateway Time-out"; then
        echo "NGINX error detected: $LINE"
        echo "Restarting NGINX..."
        systemctl restart nginx
    fi
done

 

and schedules to run every minute with * * * * *

 

1327316307_Screenshot2024-04-20at10_17_17.thumb.png.97b4e70552326cb8bbe5ef0acf3ae5b5.png

 

907179104_Screenshot2024-04-20at10_17_38.thumb.png.61e041b707c2a10f81cd1b3b7aa0e98a.png

  • Community Expert

I sometimes see this on older hardware and only at boot.

Using your script above one could use the flash drive's go file for this.

Otherwise, the above script in a cron via the user script plug doe indeed accomplish this.

The go file is located at /boot/config in unraid or in the config folder when the unraid flash drive is plugged into another PC.


My understanding is that unraid uses nginx for ssl https. They now use emhttp for the main web gui server.

 

This is why the go file default starts the web server:
#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &

to only have this on boot:

edit the go file to:

 

#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &

#Nginx SSL - Https Check
NGINX_LOG="/var/log/nginx/error.log"

# Monitor NGINX error log for specific error messages
tail -n0 -F ${NGINX_LOG} | while read LINE; do
    if echo $LINE | grep -q "504 Gateway Time-out"; then
        echo "NGINX error detected: $LINE"
        echo "Restarting NGINX..."
        /etc/rc.d/rc.nginx restart
    fi
done


Unraid doesn't have services nor systemctl to check a server

/etc/rc.d/rc.%service_Name%

 

ex

/etc/rc.d/rc.nginx status

 

Edited by bmartino1

  • Author

Thanks hmm ok weird.

 

For me a I have a 13500H and it only happens very rarely usually after a container update.

Specifically this happened after updating 'netdata' while the server was doing some other intensive tasks. It would also happen occasionally on the old server. Hence looking for a solution other than shutdown / reboot the server which can cause a parity error if its locked up something else.

 

When I do a search for '504 nginx' its quite common but no one seems to have built this kind of script into the OS yet.

 

Edited by dopeytree

  • Community Expert

are you  runnign lattes release?
6.12.10

if runing 6.12.8 or 6.12.9 you need to install the docker patch from squid.

  • Author

On latest release.

 

Anyway why would docker lock up the GUI's nginx SSL layer?

Edited by dopeytree

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.