Everything posted by KDY
-
Can not access web page (500 Internal Server Error)
I found why this error occurred, This happened entirely because of my mistake. I use a plugin called user.script. It's a simple file-moving script like the one below. #!/bin/bash shopt -s nullglob SRC="/mnt/cache/recorders" DST="/mnt/user/backup/recorders" for cam in cam1 cam2 cam3 cam4; do files=( $(ls -1 "$SRC"/${cam}_*.mp4 2>/dev/null | sort) ) count=${#files[@]} if (( count > 1 )); then for ((i=0; i<count-1; i++)); do f="${files[$i]}" mv "$f" "$DST/" done fi done At first glance, it doesn’t seem problematic, but if the SRC directory doesn’t actually exist, this becomes a serious issue. I think the ls command is pointing to /usr/local/emhttp/ and moving those files to DST. This wasn’t a problem with user.script or unraid, it was my fault for writing dumb code.
-
Can not access web page (500 Internal Server Error)
Same Error: https://forums.unraid.net/topic/186646-unraid-web-gui-inaccessible-with-error-500/ syslog Sep 22 07:56:39 NAS nginx: 2025/09/22 07:56:39 [error] 4739#4739: *88870 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.0.3, server: , request: "GET /Main HTTP/1.1", subrequest: "/auth-request.php", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "192.168.0.2" Sep 22 07:56:39 NAS nginx: 2025/09/22 07:56:39 [error] 4739#4739: *88870 auth request unexpected status: 404 while sending to client, client: 192.168.0.3, server: , request: "GET /Main HTTP/1.1", host: "192.168.0.2" Sep 22 07:56:39 NAS nginx: 2025/09/22 07:56:39 [error] 4739#4739: *88872 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.0.3, server: , request: "GET /favicon.ico HTTP/1.1", subrequest: "/auth-request.php", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "192.168.0.2", referrer: "http://192.168.0.2/Main" Sep 22 07:56:39 NAS nginx: 2025/09/22 07:56:39 [error] 4739#4739: *88872 auth request unexpected status: 404 while sending to client, client: 192.168.0.3, server: , request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.2", referrer: "http://192.168.0.2/Main" I found why this error occurred, origin /usr/local/emhttp/ root@NAS:/usr/local/emhttp# ls -alh total 37K drwxr-xr-x 1 root root 80 Jun 22 09:17 ./ drwxr-xr-x 1 root root 60 Jun 22 09:17 ../ -rw-r--r-- 1 root root 1.6K Nov 16 2023 auth-request.php lrwxrwxrwx 1 root root 5 Nov 16 2023 boot -> /boot/ -rw-r--r-- 1 root root 15K Nov 16 2023 favicon.ico drwxr-xr-x 1 root root 60 Nov 16 2023 languages/ lrwxrwxrwx 1 root root 8 Nov 16 2023 log -> /var/log/ -rw-r--r-- 1 root root 6.6K Nov 16 2023 logging.htm -rw-r--r-- 1 root root 1.5K Feb 3 2024 login.php lrwxrwxrwx 1 root root 4 Nov 16 2023 mnt -> /mnt/ drwxr-xr-x 1 root root 120 Jun 22 09:17 plugins/ -rw-r--r-- 1 root root 1.7K Jan 23 2025 redirect.htm -rw-r--r-- 1 root root 26 Nov 16 2023 robots.txt lrwxrwxrwx 1 root root 17 Nov 16 2023 state -> /var/local/emhttp/ -rw-r--r-- 1 root root 3.0K Nov 16 2023 update.htm -rw-r--r-- 1 root root 5.9K Aug 28 2024 update.php lrwxrwxrwx 1 root root 15 Nov 16 2023 webGui -> plugins/dynamix/ error then root@NAS:/usr/local/emhttp# ls -alh total 0 drwxr-xr-x 1 root root 320 Sep 22 04:30 ./ drwxr-xr-x 1 root root 60 Jun 22 09:17 ../ drwxr-xr-x 1 root root 60 Nov 16 2023 languages/ drwxr-xr-x 1 root root 140 Jun 22 09:17 plugins/ lrwxrwxrwx 1 root root 15 Nov 16 2023 webGui -> plugins/dynamix/ I do not know why some files removed..
-
Upload directly to unraid with scp
The answer to why I use scp is that I learned about scp while using the putty program and I simply used scp. It's time for me to learn about rsync now! Among the script contents you sent, I have a question about permission settings. # ls -alh /mnt/user/ drwxrwxrwx 1 nobody users 14 Nov 28 00:00 ./ drwxr-xr-x 8 root root 160 Nov 28 00:00 ../ drwxrwxrwx 1 nobody users 68 Nov 28 00:00 user_name/ # ls -alh /mnt/user/user_name/ drwxrwxrwx 1 nobody users 20 Nov 28 00:00 ./ drwxrwxrwx 1 nobody users 14 Nov 28 00:00 ../ drwxrwxrwx 1 user_name users 3.2K Nov 28 00:00 backup_directory/ -rwxrw-rw- 1 user_name users 2.4G Nov 28 00:00 web.tar.gz* This is a portion of the files and directories uploaded via smb. The permissions of the directory is 777. The permissions of the file is 766. The owner of main directory(/mnt/user/user_name/) is nobody:users. The owner of sub directory(/mnt/user/user_name/backup_dir) is user_name:users. I think it's okay to use 666 permissions, but I'm worried that it will cause problems when using Unraid later. I've looked around and it looks like there's no official documentation for this. I'll check out other plugins that use rsync and update if I find anything that requires modification to the script!
-
Upload directly to unraid with scp
I looked through some posts. - https://forums.unraid.net/topic/88128-newbie-question-copying-an-external-usb-drive-to-array/ - https://www.reddit.com/r/unRAID/comments/qb3dze/rsyncscp_to_unraid_but_what_for_the_destination/?rdt=54333 First of all, I want to automatically back up data on a remote server and upload it to unraid using a User-Scripts unraid plugins. After creating a script in User-Scripts, I modified the script as follows. #!/bin/bash ### copy fp # ssh-keyscan 192.168.0.2 > /boot/config/ssh/root/known_hosts ### ssh -i /boot/config/ssh/root/server.pem -p 22 [email protected] 'tar -cf /root/web.tar /var/www/html/' scp -i /boot/config/ssh/root/server.pem -P 22 [email protected]:/root/web.tar /where/is/safe/directory/ ssh -i /boot/config/ssh/root/server.pem -p 22 [email protected] 'rm /root/web.tar' I know that `/mnt/user/user_name/` is safe from parity checks on uploads. Is it really safe? And also, when copying files with scp, the file permissions and owner seem to be incorrect. Is this also safe? Or should I fix it as below? chmod -R user_name:users /where/is/safe/directory/ find /where/is/safe/directory/ -type d -print0 | xargs -0 chmod 0777 find /where/is/safe/directory/ -type f -print0 | xargs -0 chmod 0766