Error 503 Cyberpanel

Khi truy cập website được host trên server Cyberpanel bị lỗi 503 cần kiểm tra file error.log của lightspeed

$ tail -n 1000 /usr/local/lsws/logs/error.log | grep ERROR
2021-06-27 05:15:14.061377 [ERROR] [2334451] [tiendie.655340]: Failed to listen socket [/tmp/lshttpd/tiendie.sock]: No space left on device
2021-06-27 05:15:15.064434 [ERROR] [2334451] [tiendie.655340]: Failed to listen socket [/tmp/lshttpd/tiendie.sock]: No space left on device
2021-06-27 05:15:16.067511 [ERROR] [2334451] [tiendie.655340]: Failed to listen socket [/tmp/lshttpd/tiendie.sock]: No space left on device
2021-06-27 05:15:17.070538 [ERROR] [2334451] [tiendie.655340]: Failed to listen socket [/tmp/lshttpd/tiendie.sock]: No space left on device
2021-06-27 05:15:18.074045 [ERROR] [2334451] [tiendie.655340]: Failed to listen socket [/tmp/lshttpd/tiendie.sock]: No space left on device
2021-06-27 05:15:19.078233 [ERROR] [2334451] [tiendie.655340]: Failed to listen socket [/tmp/lshttpd/tiendie.sock]: No space left on device
2021-06-27 05:15:20.081792 [ERROR] [2334451] [tiendie.655340]: Failed to listen socket [/tmp/lshttpd/tiendie.sock]: No space left on device
2021-06-27 05:15:21.085203 [ERROR] [2334451] [tiendie.655340]: Failed to listen socket [/tmp/lshttpd/tiendie.sock]: No space left on device
2021-06-27 05:15:22.089223 [ERROR] [2334451] [tiendie.655340]: Failed to listen socket [/tmp/lshttpd/tiendie.sock]: No space left on device

Nếu xuất hiện lỗi Failed to listen socket [/tmp/lshttpd/ cần kiểm tra thêm partition tmp xem có bị full hay không

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            474M     0  474M   0% /dev
tmpfs            99M  988K   98M   1% /run
/dev/vda1        25G   18G  6.5G  74% /
tmpfs           491M  1.0M  490M   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           491M     0  491M   0% /sys/fs/cgroup
/dev/vda15      105M  9.2M   96M   9% /boot/efi
/dev/loop6      1.5G  1.5G     0 100% /tmp
/dev/loop8       33M   33M     0 100% /snap/snapd/11588
/dev/loop7       56M   56M     0 100% /snap/core18/1997
/dev/loop1       70M   70M     0 100% /snap/lxd/20309
tmpfs            99M     0   99M   0% /run/user/0
/dev/loop3       56M   56M     0 100% /snap/core18/2066
/dev/loop2       33M   33M     0 100% /snap/snapd/12159
/dev/loop4       62M   62M     0 100% /snap/core20/1026
/dev/loop5       67M   67M     0 100% /snap/lxd/20789

Nguyên nhân là do session của php không được clear trong 1 thời gian dài dẫn đến full /tmp

Các bước khắc phục:

  • Stop lightspeed systemctl stop lshttpd
  • xóa các file file session trong /tmp/lshttpd/ bằng cách
$ cd /tmp && find . -name '*' | xargs rm -rf
# tắt phpsessionclean
$ systemctl stop phpsessionclean.service
$ systemctl disable phpsessionclean.service
$ systemctl stop phpsessionclean.timer
$ systemctl disable phpsessionclean.timer
# thêm cron bên dưới
$ crontab -e
*/30 * * * * find -O3 "/tmp" -ignore_readdir_race -depth -mindepth 1 -name 'sess_*' -type f -cmin +180 -delete

Cuối cùng, start lại lightspeed

systemctl start lshttpd

Leave a Reply

Your email address will not be published. Required fields are marked *