Hướng dẫn cài đặt OpenLiteSpeed trên VPS sử dụng DirectAdmin

Để cài đặt OpenLiteSpeed trên VPS sử dụng DirectAdmin thì điều đầu tiên bạn cần kiểm tra đó chính là phiên bản DirectAdmin phải từ 1.57.0 trở lên và bạn phải đang sử dụng CustomBuild 2.0

Bước 1: Đăng nhập SSH

Bước 2: Chạy lệnh

cd /usr/local/directadmin/custombuild
./build set webserver openlitespeed
./build set php1_mode lsphp
./build openlitespeed
./build php n
./build rewrite_confs

Nếu bạn có nhiều hơn 1 phiên bản php, hãy thêm lệnh set php#_mode lsphp cho tất cả các phiên bản php khác. (trong đó # là 2, 3 hoặc 4)

Ví dụ mình đang chạy tổng cộng 4 phiên bản php thì mình sẽ chạy lệnh như sau:

cd /usr/local/directadmin/custombuild./build set webserver openlitespeed./build set php1_mode lsphp./build set php2_mode lsphp./build set php3_mode lsphp./build set php4_mode lsphp./build openlitespeed./build php n./build rewrite_confs

Lưu ý: trong quá trình chạy lệnh ./build openlitespeed nếu bạn gặp lỗi “Openlitespeed webserver configuration option is not compatible with lsphp or php-fastcgi PHP mode with mode_ruid2 enabled.” thì bạn chạy lệnh:

./build set mod_ruid2 no

Sau đó chạy lại lệnh ở Bước 2.

Bước 3: Đặt cronjob để reload file .htaccess

Khi website của bạn sử dụng .htaccess thì bạn cần tạo thêm cronjob có nội dung bên dưới để khi bạn thay đổi file .htaccess thì OpenLiteSpeed sẽ tự động reload lại.

*/5 * * * * root if ! find /home/*/domains/*/*_html/ -maxdepth 2 -type f -newer /usr/local/lsws/cgid -name '.htaccess' -exec false {} +; then /usr/local/lsws/bin/lswsctrl restart; fi

*/5 có nghĩa là cứ 3 phút sẽ chạy cron 1 lần.

Was this article helpful?

Related Articles

Leave A Comment?

This site uses Akismet to reduce spam. Learn how your comment data is processed.