Hướng dẫn cài đặt Litespeed Web Server trên CentOS 7

Hướng dẫn cài đặt Litespeed Web Server trên CentOS 7LiteSpeed Web Server là một trong những dịch vụ web khá nổi tiếng chỉ đứng thứ 4 sau ApacheNginx,… Với nhiệm vụ cao cả là mong muốn thay thế được Apache Web Server. Máy chủ web LiteSpeed sẽ cải thiện hiệu năng hệ thống của bạn và giảm chi phí vận hành. Nó tương thích với các tính năng Apache được sử dụng phổ biến như mod_rewrite, .htaccess, và mod_security. Sử dụng máy chủ web LiteSpeed bạn có thể sử dụng tập tin cấu hình Apache trực tiếp và nó hoạt động như một sự thay thế cho máy chủ web apache. Bài viết  này sẽ giúp bạn cài đặt máy chủ web LiteSpeed trên CentOS 7. (Tìm hiểu thêm: LiteSpeed là gì ? Tìm hiểu về LiteSpeed Web Server)

cài đặt litespeed web server

Có thể bạn cũng quan tâm chủ đề khác:
Top 11 chương trình thay thế Google Analytics
Kích hoạt mod_rewrite Apache trên CentOS/Ubuntu
Hướng dẫn cài đặt Apache trên CentOS
Cài đặt Webmin trên CentOS quản lý VPS/Hosting
Cài đặt Nginx trên CentOS

Lưu ý:
Hướng dẫn copy lệnh command trên website Cuongquach.com 

1. Cài đặt các chương trình cần thiết

– Đối với từng dịch vụ hoặc chương trình khi được cài đặt sẽ theo kèm một số ít các gói chương trình phụ thuộc (dependencies) nên bạn cần phải cài đặt chúng để hỗ trợ tốt nhất cho việc cài đặt LiteSpeed Web Server.

# yum update –y
# yum install epel-release -y
# yum groupinstall -y 'Development Tools'
# yum install -y libxml2-devel openssl-devel bzip2-devel libcurl-devel db4-devel libjpeg-devel libpng-devel libXpm-devel freetype-devel gmp-devel libc-client-devel openldap-devel libmcrypt-devel mhash-devel freetds-devel zlib-devel mysql-devel ncurses-devel pcre-devel unixODBC-devel postgresql-devel sqlite-devel aspell-devel readline-devel recode-devel net-snmp-devel libtidy-devel libxslt-devel t1lib-devel wget

2. Cài đặt Litespeed Web Server Standard

2.1 Download gói cài đặt LSWS Standard

Xác định kiến trúc vi xử lý của máy chủ Linux. Như output lệnh ‘uname‘ ở dưới là máy chủ Linux đang sử dụng kiến trúc vi xử lý x86_64 (64 bit).

# uname -a
Linux vs00358-27 2.6.32-696.1.1.el6.x86_64 #1 SMP Tue Apr 11 17:13:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

– Truy cập trang chủ download mã nguồn cài đặt Litespeed Web Server : LINK

litespeed web server download package

# wget https://www.litespeedtech.com/packages/5.0/lsws-5.2.3-ent-x86_64-linux.tar.gz
# tar -xvfz lsws-5.2.3-ent-x86_64-linux.tar.gz

2.2 Cài đặt LSWS

– Bây giờ để cài đặt được LiteSpeed bạn phải mua license hoặc đăng ký license trial theo link: LINK .

License key sẽ được gửi về mail của bạn, bạn check mail và tải về sẵn trên máy tính để upload lên máy chủ Linux. Bạn để file trial.key vào thư mục cài đặt LSWS.

# mv trial.key lsws-5.2.3
# cd lsws-5.2.3
# ./install.sh

– Sau khi bạn đọc hết điều khoản Litespeed sẽ hỏi bạn đồng ý với các điều trên không, bạn ấn “Y” để tiếp tục.

Copyright (c) 2002-2003 Lite Speed Technologies Inc. All rights reserved.

IMPORTANT: In order to continue installation you must agree with above
license terms by typing "Yes" with capital "Y"!

Do you agree with above license? Yes

– Sau khi bạn chọn Yes thì LiteSpeed sẽ hỏi bạn tiếp thư mục cài đặt chương trình Litespeed Web Server sẽ lưu vào đâu, bạn cứ Enter là được.

Please specify the destination directory. You must have permissions to
create and manage the directory. It is recommended to install the web server
at /opt/lsws, /usr/local/lsws or in your home directory like '~/lsws'.

ATTENTION: The user 'nobody' must be able to access the destination
directory.

Destination [/usr/local/lsws]:

– Tới đây nếu bạn thấy báo lỗi như sau. Là do bạn đã chưa để file ‘trial.key‘ vào thư mục cài đặt LSWS đó.

[ERROR] Sorry, installation will abort without a valid license key.

For evaluation purpose, please obtain a trial license key from our web
site http://www.litespeedtech.com, copy it to this directory
and run Installer again.

If a production license has been purchased, please copy the serial number
from your confirmation email to this directory and run Installer again.

NOTE:
Please remember to set ftp to BINARY mode when you ftp trial.key from
another machine.

LiteSpeed sẽ hỏi tiếp bạn muốn nhập thông tin user quản trị là gì, ở đây mình để admin luôn, bạn có thể tùy chỉnh tùy ý mình. Bạn cũng sẽ cần phải điền password và email quản trị của bạn vào, chú ý là bạn có thể nhập nhiều email khác nhau, chỉ cần cách ra một khoảng trắng là được.

User name [admin]:

Please specify the administrator's password.
This is the password required to log into the administration web interface.

Password:
Retype password:

Please specify administrators' email addresses.
It is recommended to specify a real email address,
Multiple email addresses can be set by a comma
delimited list of email addresses. Whenever something
abnormal happened, a notificiation will be sent to
emails listed here.

Email addresses [root@localhost]:

LiteSpeed sẽ hỏi bạn tiếp rằng bạn có sử dụng LSWS với Control Panel nào khác không, ở đây mình không sử dụng (0), còn nếu các bạn có sử dụng thì chọn vào nhé.

Will you use LiteSpeed Web Server with a hosting control panel?

0. NONE
1. cPanel
2. DirectAdmin
3. Plesk
4. Hsphere
5. Interworx
6. Lxadmin
7. ISPManager
Please select (0-7) [0]? 0

– Trình cài đặt sẽ nhắc bạn tiếp phần nhập vào usergroup để chạy service LSWS này. Điều quan trọng là bạn không nên chạy với quyền user root vì sẽ không an toàn và bảo mật. Tốt nhất cứ để “nobody” là được. Port dịch vụ web mình chọn 80 luôn các bạn nhé.

As you are the root user, you must choose the user and group
whom the web server will be running as. For security reason, you should choose
a non-system user who does not have login shell and home directory such as
'nobody'.

User [nobody]:
Please choose the group that the web server running as.

User 'nobody' is the member of following group(s): nobody access
Group [nobody]:

Please specify the port for normal HTTP service.
Port 80 is the standard HTTP port, only 'root' user is allowed to use
port 80, if you have another web server running on port 80, you need to
specify another port or stop the other web server before starting LiteSpeed
Web Server.
You can access the normal web page at http://<YOUR_HOST>:<HTTP_PORT>/

HTTP port [8088]: 80

– Tiếp theo trình cài đặt sẽ nhắc các bạn về port quản trị dịch vụ LSWS, mặc định là port 7080.

Please specify the HTTP port for the administration web interface,
which can be accessed through http://<YOUR_HOST>:<ADMIN_PORT>/

Admin HTTP port [7080]:

– Tiếp đến là nhắc chúng ta có setup PHP hay không. Nếu bạn đang chạy một website CMS dạng WordPress, Joomla thì chọn Y luôn nhé.

You can setup a global script handler for PHP with the pre-built PHP engine
shipped with this package now. The PHP engine runs as Fast CGI which
outperforms Apache's mod_php.
You can always replace the pre-built PHP engine with your customized PHP
engine.

Setup up PHP [Y/n]: Y

– Trình cài đặt sẽ hỏi bạn tiếp rằng bạn có muốn chỉ định extension nào khác không, thông thường là không, bạn enter luôn nhé.

Suffix for PHP script(comma separated list) [php]:

LiteSpeed Web Server Enterprise Edition can run in chroot environment.
It is impossible for the chrooted process and its children processes to
access files outside the new root directory.

With chroot configured properly, there is no need to worry about sensitive
data being accidentally exposed by insecure CGI programs or web server itself.
Even when a hacker some how gain a shell access, all files he can access is
under the chrooted directory.

This installation script will try to setup the initial chroot environment
automatically.

However, it is not easy to setup a chroot environment and you CGI program may
break. So we do not recommend enabling it for the first time user.
It can be enabled later by running this installation script again.

– LiteSpeed sẽ hỏi tiếp có bật chroot không, bạn chọn No nhé.

Enable chroot [y/N]: No

– Trình cài đặt sẽ hỏi tiếp bạn có muốn sử dụng AWStats hay không, đây là chương trình sẽ dụng công cụ để tạo thống kê như kiểm tra số lượng khách truy cập, pages view… Để cho phép bật tính năng nay bạn chọn Y, còn không thì .

AWStats Integration

AWStats is a popular log analyzer that generates advanced web server
statistics. LiteSpeed web server seamlessly integrates AWStats into
its Web Admin Interface. AWStats configuration and statistics update
have been taken care of by LiteSpeed web server.

Note: If AWStats has been installed already, you do not need to
install again unless a new version of AWStats is available.

Would you like to install AWStats Add-on module [y/N]? N

– Và xin chúc mừng bạn, LSWS đã được cài đặt thành công, bạn chọn Y để restart lại LiteSpeed để nhận cấu hình.

To change configurations of the interface, login and click
"Interface Configuration" button on the main page.
The administration interface is located at http://localhost:<ADMIN_PORT>/
or http://<ip_or_Hostname_of_this_machine>:<ADMIN_PORT>/

Would you like to have LiteSpeed Web Server started automatically
when the server restarts [Y/n]? Y

[OK] The startup script has been successfully installed!
Would you like to start it right now [Y/n]? Y

[ERROR] Invalid serial number!
2018-01-14 10:34:45.617 [NOTICE] Memory size is: 1016144KB.
2018-01-14 10:34:46.731 [NOTICE] [OK] Updated license key has been created at /usr/local/lsws/conf/trial.key.
[OK] litespeed: pid=15454.

– Cấu hình tường lửa firewall để cho phép truy cập vào port 80 và port quản lý 7080.

# iptables -I INPUT -p tcp --dport 80 -j ACCEPT
# iptables -I INPUT -p tcp --dport 7080 -j ACCEPT
# service iptables save

Truy cập vào địa chỉ https://IP:7080 bạn sẽ thấy giao diện đăng nhập trang quản lý của dịch vụ Web Server LiteSpeed .

Như vậy là hướng dẫn cài đặt Litespeed Web Server standard trên CentOS 7 của mình hoàn tất rồi. Phần còn lại là bạn sẽ tiếp tục công cuộc tìm hiểu cách sử dụng LiteSpeed Web Server này nhé. Cám ơn các bạn đã theo dõi. Có ý kiến nào khác các bạn để lại comment tại Cuongquach.com nhé.

Nguồn: https://cuongquach.com/

Previous articleHướng dẫn đổi tên card mạng trên Linux – Network Interface
Next article[AWS] Tìm hiểu về tường lửa AWS EC2 Security Group là gì ?
Bạn đang theo dõi website "https://cuongquach.com/" nơi lưu trữ những kiến thức tổng hợp và chia sẻ cá nhân về Quản Trị Hệ Thống Dịch Vụ & Mạng, được xây dựng lại dưới nền tảng kinh nghiệm của bản thân mình, Quách Chí Cường. Hy vọng bạn sẽ thích nơi này !