
OpenLiteSpeed là phiên bản mã nguồn mở của LiteSpeed Web Server Enterprise. OpenLiteSpeed chứa tất cả các tính năng cần thiết có trong LiteSpeed Enterprise, bao gồm LSCache (plugin cần thiết cho WordPress).
Hiện tại OpenLiteSpeed được trang bị sẳn khi bạn sử dụng CyberPanel . Tuy nhiên với sự phát triển mở rộng giờ đây bạn đã có thể cài đặt OpenLiteSpeed trên DirectAdmin (DA) .
Để 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
Hướng dẫn nâng cấp lên Custombuild 2.0 trong Directadmin
DirectAdmin đi kèm với một công cụ được xây dựng sẵn có tên là CustomBuild, cho phép bạn cài đặt, gỡ bỏ hoặc biên dịch lại các chương trình. Gần đây, đã có một sửa đổi của CustomBuild (thường được viết tắt là CB) để phiên bản 2.0. Trong hướng dẫn này, bạn sẽ thấy cách nâng cấp cài đặt CustomBuild 1.1 hoặc 1.2 lên 2.0.
Bước 1: Cài đặt lại các gói hỗ trợ
yum install wget gcc gcc-c++ flex bison make bind bind-libs bind-utils openssl openssl-devel perl quota libaio \ libcom_err-devel libcurl-devel gd zlib-devel zip unzip libcap-devel cronie bzip2 cyrus-sasl-devel perl-ExtUtils-Embed \ autoconf automake libtool which patch mailx bzip2-devel lsof db4-devel psmisc net-tools systemd-devel libdb-devel perl-DBI xfsprogs rsyslog logrotate crontabs
Bước 2: Cập nhật CustomBuild
cd /usr/local/directadmin mv custombuild custombuild_1.x wget -O custombuild.tar.gz http://files.directadmin.com/services/custombuild/2.0/custombuild.tar.gz tar xvzf custombuild.tar.gz cd custombuild ./build
Bước 3: Thay đổi các tùy chọn
Sau khi thực hiện ./build
, tệp cấu hình tùy chọn mới đã được tạo. Mở tập tin này và thực hiện các thay đổi cần thiết.
Sau khi xác nhận thay đổi của bạn là chính xác, cài đặt phần mềm theo cấu hình CustomBuild:
./build all d ./build rewrite_confs
Cài đặt OpenLiteSpeed lên DirectAdmin
Bước 1: SSH vào VPS
Có nhiều tools hỗ trợ ssh vào vps hnuw Xshell, PuTTY… và bạn có thể xem hướng dẫn SSH vào VPS tại link bên dưới.
Bước 2: Chạy lệnh cài đặt
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
Bước 3: Đặt cron reload
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.
*/3 * * * * 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
*/3 có nghĩa là cứ 3 phút sẽ chạy cron 1 lần. Bạn có thể thay thế số 3 thành số khác theo ý bạn.


