អូផឹនស៊ូស៊ី, the open-source edition of ល្បឿនលឿន, is a high-performance yet lightweight web server application. I will guide you through the process of installing and configuring an OpenLiteSpeed instance on your server. We will also install and configure MariaDB to facilitate interaction with many common web applications and services. WordPress will not be installed at this time. One more thing you should know is that, What Cloud Hosting does, Cloud Servers can do better. As a result, you can use everything you’ve learned from this tutorial to apply to Cloud Server without any problems at all
ចំណាំ:
នេះ អូផឹនស៊ូស៊ី និង ល្បឿនលឿន ម៉ាស៊ីនបម្រើបណ្ដាញ គឺជាផលិតផលពីរផ្សេងគ្នា. ប្រសិនបើអ្នកចង់ស្វែងយល់បន្ថែមអំពីភាពខុសគ្នាជាក់លាក់នេះ សូមមើល ការប្រកាសនេះ
តម្រូវការជាមុន
- Before you begin this guide, there are some important steps that you must complete to prepare your server
- A Centos OS7 x 64 servers (Cloud Hosting or Cloud Server) instance
The 17 Detailed Steps to Install WordPress on Cloud Server using OpenLiteSpeed Web Server
ជំហានទី 1: កំណត់ Cloud Server/ Cloud Hosting របស់អ្នកឡើងវិញ
You can skip this step if your Server (Cloud Hosting or Cloud Server) is brand new.
However, if your Server (Cloud Hosting or Cloud Server) was previously used for a specific purpose, such as putting up a website, building an application,…etc. Then these existing packages and current setup configurations are likely to conflict with packages and configurations that will be deployed in the future.
→ កំណត់ម៉ាស៊ីនមេរបស់អ្នកឡើងវិញគឺជាការចាំបាច់ ហើយកុំភ្លេចបម្រុងទុកទិន្នន័យរបស់អ្នកមុនពេលកំណត់ឡើងវិញ
ជំហានទី 2: ចូលទៅក្នុង Cloud Server/ Cloud Hosting របស់អ្នក។
There are 2 ways to login
ជំហានទី 3៖ ធ្វើបច្ចុប្បន្នភាពប្រព័ន្ធ និងដំឡើងឧបករណ៍មូលដ្ឋានមួយចំនួន
Regardless of what you decide to do, you should first make sure that all of your packages is up to date.
#Run these commands one-by-one
yum install epel-release -y
yum clean all && sudo yum update -y && sudo shutdown -r now
After running the above command, you will get disconnected from the server, because the server is rebooting remember to log in to the server again to be able to perform the steps below
Afterward, we’ll need to install the wget, unzip, and nano កញ្ចប់. ពាក្យបញ្ជាទាំងនេះនឹងមានប្រយោជន៍នៅពេលអនាគត។
If a package is already installed on the Server, skip that package and install the next one.
#Remember to run these commands one by one
rpm -q nano #Checking
sudo yum install nano -y #Installing
- ណាណូ៖ a command-line-based text editor
ជំហានទី 4៖ កំណត់រចនាសម្ព័ន្ធ yum.conff
តាមលំនាំដើម, 1Byte provides the Server with ការកំណត់រចនាសម្ព័ន្ធ (ពាក្យបញ្ជា yum) ដែលរារាំងអ្នកពីការដំឡើងកញ្ចប់ជាក់លាក់។ ជាអកុសល កញ្ចប់ម៉ាស៊ីនបម្រើបណ្តាញ OpenLiteSpeed មួយចំនួនស្ថិតក្នុងចំណោមកញ្ចប់ទាំងនេះ ដូច្នេះយើងនឹងលុបពួកវាចេញពីការកំណត់រចនាសម្ព័ន្ធនោះពី ពាក្យបញ្ជា yum.
nano /etc/yum.conf
→ អ្នកត្រូវតែដកកញ្ចប់ទាំងនេះចេញពីបន្ទាត់ដកចេញ (បន្ទាត់ចុងក្រោយ)។ បើនៅតែយល់ច្រលំ សូមមើលវីដេអូខាងក្រោម។
ជំហានទី 5៖ ដំឡើង OpenLiteSpeed Repository និងសមាសធាតុរបស់វា។
Add the repository
rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm
Install OpenLiteSpeed from the repository
yum install openlitespeed -y
The following commands will install PHP 7.4 for OpenLiteSpeed from our repository with all commonly-used packages, and direct OpenLiteSpeed to use this PHP. This build of PHP should be enough to support the most commonly used web applications.
#Install PHP version 7.4
yum install lsphp74 lsphp74-json lsphp74-common lsphp74-gd lsphp74-imagick lsphp74-process lsphp74-mbstring lsphp74-mysqlnd lsphp74-xml lsphp74-opcache lsphp74-mcrypt lsphp74-pdo lsphp74-imap lsphp74-bcmath lsphp74-pecl-memcache lsphp74-pecl-memcached lsphp74-pecl-redis lsphp74-pgsql lsphp74-zip -y
#Link PHP of OpenLiteSpeed to the new PHP Version 7.4
ln -sf /usr/local/lsws/lsphp74/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp74
With all of our components installed, we can now take care of some configurations.
ជំហានទី 6: ផ្លាស់ប្តូរពាក្យសម្ងាត់អ្នកគ្រប់គ្រងលំនាំដើមសម្រាប់ OpenLiteSpeed
First, we should change the ពាក្យសម្ងាត់រដ្ឋបាលលំនាំដើមសម្រាប់ OpenLiteSpeed. តាមលំនាំដើម វាត្រូវបានកំណត់ទៅជា "123456“. This password is very weak and easy to guess, so we must modify this value immediately.
To change the password, execute the following script:
/usr/local/lsws/admin/misc/admpass.sh
You can optionally select a ឈ្មោះអ្នកប្រើថ្មីសម្រាប់គណនីរដ្ឋបាលឬគ្រាន់តែចុច ENTER ដើម្បីទទួលយកតម្លៃលំនាំដើមនៃ គ្រប់គ្រង. Afterward, you will have to supply and verify a password for the administrative user. ត្រូវប្រាកដថាជ្រើសរើសពាក្យសម្ងាត់ខ្លាំង ដោយសារតែអេក្រង់ចូលរដ្ឋបាលត្រូវបានបើកទៅកាន់បណ្តាញតាមលំនាំដើម។
ចំណាំ:
This username and password at this step will be used to login into កុងសូល WebAdmin
→ Please write down or keep note of your credential
If you are still confused, check the video below
ជំហានទី 7៖ ដំឡើង ផ្កាយ និងធានាប្រព័ន្ធ MariaDB
Next, we need to install MariaDB version 10.6 and start the MariaDB database system as well as do some simple configuration
#Add MariaDB into Repository
echo '[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1' > /etc/yum.repos.d/MariaDB.repo
#removes the cache of repositories
yum clean all
#Update all packages again
yum update -y
#Install MariaDB version 10.6
yum install MariaDB-server MariaDB-client -y
#Start MariaDB
systemctl start mariadb
#Enable MariaDB after machine reboot
systemctl enable mariadb
With MariaDB online, we can run a simple security script to set an administrative password and lock down some insecure defaults:
sudo mysql_secure_installation
First, it will ask you for the ពាក្យសម្ងាត់ root MariaDB. ដោយសារយើងមិនទាន់បានកំណត់មួយនៅឡើយទេគ្រាន់តែចុច ENTER បន្ត។ ជំហានបន្ទាប់គឺសួរអ្នក។ កំណត់ពាក្យសម្ងាត់ root. ជ្រើសរើស និងបញ្ជាក់ពាក្យសម្ងាត់រដ្ឋបាលសម្រាប់ប្រព័ន្ធមូលដ្ឋានទិន្នន័យ។
For the remainder of the questions, you can just hit ENTER ដើម្បីទទួលយកការណែនាំលំនាំដើម។ វានឹងត្រឡប់ការកំណត់ដែលមិនមានសុវត្ថិភាពមួយចំនួននៅលើប្រព័ន្ធទិន្នន័យរបស់យើង។
If you are still confused, check the video below
Finally, reset the MariaDB service to take effect
systemctl restart mariadb
ជំហានទី 8: កំណត់រចនាសម្ព័ន្ធ firewall-cmd
តាមលំនាំដើមឯកសារ WebAdmin Console (ទំព័រគ្រប់គ្រង) រត់លើ កំពង់ផែ 7080.
Therefore, allow yourself to access via port 7080 (WebAdmin Console). This port must be opened.
#Check all opened ports
firewall-cmd --list-all
#Allow port 7080 for WebConsole Admin Page
firewall-cmd --permanent --zone=public --add-port=7080/tcp
#Reload to take effect
firewall-cmd --reload
ជំហានទី 9: សាកល្បងគេហទំព័រលំនាំដើម និងចំណុចប្រទាក់អ្នកគ្រប់គ្រង
ម៉ាស៊ីនមេ OpenLiteSpeed គួរតែដំណើរការរួចហើយ។ ប្រសិនបើអ្នកត្រូវការចាប់ផ្តើម បញ្ឈប់ ចាប់ផ្តើមឡើងវិញ ឬពិនិត្យមើលស្ថានភាពរបស់ម៉ាស៊ីនមេ សូមប្រើស្តង់ដារ service
បញ្ជាជាមួយ lsws
ឈ្មោះសេវាកម្ម៖
#Check Status server
sudo systemctl status lsws
#Start
sudo systemctl start lsws
#Stop
sudo systemctl stop lsws
#Restart
sudo systemctl restart lsws
In your web browser, you can check out OpenLiteSpeed’s WebAdmin Console page. Navigate to your server’s IP address, followed by :7080 specifying the port:
http://:7080
You will likely see a page warning you that the ពួកគេផ្តល់វិញ្ញាបនបត្រ SSL from the server cannot be validated. Since we have not installed an SSL certificate for this website, this is expected. Click through the options available to proceed to the site (in Chrome, you must click កម្រិតខ្ពស់ ហើយបន្ទាប់មកជ្រើសរើស បន្តទៅ… )
You will be prompted to enter the administrator name and password that you selected in ជំហានទី 6
Once you correctly authenticate, you will be presented with the OpenLiteSpeed administration interface (WebConsole Admin)
Step 10: Change the port of the Default Page (Port 8080)
As explained above, we now will change the port that the default site is using from 8088 ទៅច្រកធម្មតា។ 80
1) On the left-bar menu, choose the អ្នកស្តាប់ ជម្រើស
2) នៅក្នុងជួរឈរ ឈ្មោះអ្នកស្តាប់, ចុចលើ Default
3) ចុចលើប៊ូតុង ប៊ូតុងកែសម្រួល នៅជ្រុងខាងស្តាំខាងលើនៃ ការកំណត់អាសយដ្ឋាន តារាងដើម្បីកែប្រែតម្លៃរបស់វា។
4) Change port 8080 ទៅច្រក 80ហើយចុចលើប៊ូតុង រូបតំណាងរក្សាទុក
5) Finally, you need to click on the Graceful Restart button. It is a square button, green background with a white arrow icon, located on the top right-hand side
If you still get confused, please check out the video below
The default web page should now be accessible in your browser on កំពង់ផែ 80 ជំនួសឱ្យច្រក 8088។ ការចូលទៅកាន់ឈ្មោះដែន ឬអាសយដ្ឋាន IP របស់ម៉ាស៊ីនមេរបស់អ្នកដោយមិនផ្តល់ច្រកនឹងបង្ហាញគេហទំព័រឥឡូវនេះ។
http://:80
#or you don't need to put :80
http://
You will see a page the default OpenLiteSpeed web page, that looks like this:
ពិរោះណាស់ !!!
At this point, you should have OpenLiteSpeed, a customized version of PHP, and MariaDB installed and running on a CentOS 7 server. OpenLiteSpeed offers great performance, an easy-to-use interface, and pre-configured options for script handling. Dive in and learn the ropes to start leveraging these capabilities to serve your sites.
Up to now, the OpenLiteSpeed web server is still missing the following features:
1) No SSL Certificate yet
2) Haven’t installed WordPress yet
But Last for Not Least…
We will focus on how to get a WordPress instance set up and running on CentOS 7 using the OpenLiteSpeed web server. Before you begin this guide, there are some important steps that you must complete to prepare your server
- This guide will not cover installing OpenLiteSpeed or MySQL.
- A Centos OS7 x 64 servers (Cloud Hosting or Cloud Server) instance
If you have not had a Cloud Hosting Cloud Server or ឈ្មោះដែន. ទិញឥឡូវនេះ so that you can start learning and practicing with 1Byte
When you are finished preparing your server using the guides linked above, you can proceed with this tutorial
ជំហានទី 11: ចូលទៅក្នុង Cloud Server/ Cloud Hosting របស់អ្នក។
ជំហានទី 12: ចូលទៅក្នុង WebAdmin Console ហើយកំណត់រចនាសម្ព័ន្ធ OpenLiteSpeed
Log into OpenLiteSpeed’s administrative interface (WebConsole Admin)
https://:7080
If prompted, log in using the username and password you configured for OpenLiteSpeed above. Next, we will configure External App
1) ទៅ។ ការកំណត់រចនាសម្ព័ន្ធម៉ាស៊ីនមេ នៅលើរបារម៉ឺនុយខាងឆ្វេង
២) ជ្រើសរើសយក កម្មវិធីខាងក្រៅ ផ្ទាំង
៥) ចុចលើ បន្ថែម ប៊ូតុង
Remember to select LSPHP setup and select LiteSpeed SAPI APP to optimize PHP for best performance
ការកំណត់ប៉ារ៉ាម៉ែត្រសម្រាប់កម្មវិធី LiteSpeed SAPI
មានច្រើន ប៉ារ៉ាម៉ែត្រ៖ តម្លៃ ដែលចាំបាច់ត្រូវរៀបចំសម្រាប់ជំហាននេះ។ សូមបញ្ចូលតម្លៃ (នៅខាងស្ដាំនៃសញ្ញាសម្គាល់) ដែលត្រូវគ្នានឹងប៉ារ៉ាម៉ែត្រ (នៅខាងឆ្វេងនៃសញ្ញាចុង) ដោយផ្អែកលើទិន្នន័យគំរូក្នុងប្លុកកូដខាងក្រោម
#Sample Data
Name: lsphp74
Address: uds://tmp/lshttpd/lsphp74.sock
Max Connections: 50
Environment:
PHP_LSAPI_CHILDREN=50
LSAPI_AVOID_FORK=200M
Initial Request Timeout (secs): 60
Retry Timeout : 0
Response Buffering: no
Start By Server: yes (Thorough CGI daemon)
Command: $SERVER_ROOT/lsphp74/bin/lsphp
Back Log: 100
Instances: 1
Memory Soft Limit (bytes): 2047M
Memory Hard Limit (bytes): 2047M
Process Soft Limit: 1400
Process Hard Limit: 1500
If you are still confused, please check out this video
After that, configuring Script Handler is a MUST
1) ទៅ។ ការកំណត់រចនាសម្ព័ន្ធម៉ាស៊ីនមេ នៅលើរបារម៉ឺនុយខាងឆ្វេង
២) ជ្រើសរើសយក កម្មវិធីគ្រប់គ្រងស្គ្រីប ផ្ទាំង
3) ចុចលើ Edit ប៊ូតុង
4) ប្តូរទៅ lsphp74 ពី ឈ្មោះអ្នកដោះស្រាយ
5) ចុចលើប៊ូតុង Save ប៊ូតុង
ជំហានទី 13: កំណត់រចនាសម្ព័ន្ធម៉ាស៊ីននិម្មិតសម្រាប់ WordPress
យើងនឹងធ្វើការផ្លាស់ប្តូរម៉ាស៊ីននិម្មិតលំនាំដើមដែលមានរួចហើយនៅក្នុងការកំណត់រចនាសម្ព័ន្ធ OpenLiteSpeed ដូច្នេះយើងអាចប្រើវាសម្រាប់តំឡើង WordPress របស់យើង។
1) ទៅ។ ម៉ាស៊ីននិម្មិត នៅលើរបារម៉ឺនុយខាងឆ្វេង
៥) ចុចលើ បន្ថែម ប៊ូតុង
Next, we need to set ប៉ារ៉ាម៉ែត្រ៖ តម្លៃ for this new Virtual Host. Please input the values (to the right of the colon) corresponding to the parameters (to the left of the colon) based on Sample Data in the code block below
#Sample Data
Virtual Host Name : 1byte-demo.com
Virtual Host Root : $SERVER_ROOT/1byte-demo.com/
Config File: $SERVER_ROOT/conf/vhosts/$VH_NAME/1byte-demo.com.conf
Follow Symbolic Link: Yes
Enable Scripts/ExtApps: Yes
Max Keep-Alive Requests: 1000
Restrained: Yes
ExtApp Set UID Mode: Server UID
ចំណាំ:
នៅពេលអ្នកចុចប៊ូតុង ប៊ូតុងរក្សាទុកប្រព័ន្ធនឹងរាយការណ៍អំពីបញ្ហានៅលើ ជួរ ៥១៤, ឯកសារ .conf មិនមានទេ។ដូច្នេះយើងនឹងចុចលើ ចុចដើម្បីបង្កើត ដើម្បីអនុញ្ញាតឱ្យប្រព័ន្ធបង្កើតឯកសារនេះសម្រាប់អ្នក។
Next, we need to configure the General section in the ទូទៅ ផ្ទាំងនៅក្នុងរបស់អ្នក។ ម៉ាស៊ីននិម្មិត
Same as above, configure the Index Files section in the ទូទៅ ផ្ទាំងរបស់អ្នក ម៉ាស៊ីននិម្មិត
ចំណាំ:
គួរកត់សំគាល់ថាចន្លោះរវាង index.php និង index.html គឺ 1 ដកឃ្លា ហើយពួកវាត្រូវបានបំបែកដោយ 1 ចន្លោះ។ មិនត្រូវបានបំបែកដោយសញ្ញាក្បៀស
Continue to configure Expires Settings in the ទូទៅ ផ្ទាំងរបស់អ្នក ម៉ាស៊ីននិម្មិត
#copy the following declaration into "Expires By Type"
image/*=A31536000, text/css=A31536000, application/x-javascript=A31536000, application/javascript=A31536000, font/*=A31536000, application/x-font-ttf=A31536000
កំណត់រចនាសម្ព័ន្ធ កំណត់ហេតុម៉ាស៊ីននិម្មិត in ចូល ផ្ទាំង
#Sample Data
Use Servers Log: Yes
File Name: $VH_ROOT/logs/error.log
Log Level: ERROR
Rolling Size (bytes): 10M
Switch to Access Log and modify as the Sample Data in the block code does
#Sample Data
Log Control: Own Log File
File Name: $VH_ROOT/logs/access.log
Piped Logger: Not Set
Log Format: Not Set
Log Headers: Not Set
Rolling Size (bytes): 10M
Keep Days: 30
Bytes log: Not Set
Compress Archive: Yes
កំណត់រចនាសម្ព័ន្ធ ការត្រួតពិនិត្យការចូលដំណើរការ ក្នុង សុវិត្ថភាព ផ្ទាំង
រុករកទៅ សរសេរឡើងវិញ tab, and add the following rules in the សរសេរច្បាប់ឡើងវិញ ផ្នែក
#Remember to change your domain name in here
rewriteFiler /usr/local/lsws/1byte-demo.com/html/.htaccess
Also in the same Rewrite tab, configure the Rewrite Control section based on Sample Data in the code block
#Sample Data Enable Rewrite: Yes
Auto Load from .htaccess: Yes
Log Level: Not Set
Finally, we need to connect our Virtual Host file to port 80
#Sample Data
Enable Rewrite: Yes
Auto Load from .htaccess: Yes
Log Level: Not Set
With all of the above configurations out of the way, we can now ចាប់ផ្តើមឡើងវិញដោយសុភាព the OpenLiteSpeed server to enable our changes. It is a square button, green background with a white arrow icon, located on the top right-hand side
ជំហានទី 14: រៀបចំ Virtual Host និង Document Root Directories
Back to your terminal, now we will create the website’s root directory
mkdir /usr/local/lsws/1byte-demo.com/
mkdir /usr/local/lsws/1byte-demo.com/{html,logs}
ចំណាំ:
/usr/local/lsws/1byte-demo.com/html/ → This absolute path is where all your website data is stored
Next, create .htaccess file
cd /usr/local/lsws/1byte-demo.com/html
nano .htaccess
#Copy these line into your .htaccess file
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Now you need to grant control for your web root directory
chown -R nobody:nobody /usr/local/lsws/1byte-demo.com/html
ជំហានទី 15៖ បង្កើត Database និង Database User សម្រាប់ WordPress
We will start by creating a database and database user for WordPress to use
mysql -u root -p
You will be prompted to enter the MariaDB administrative password that you already created in Part 1 – Step 7. Afterward, you will be dropped into a MariaDB prompt
Running these commands to create , និង
#create named "wordpress"
CREATE DATABASE wordpress;
#create named "wordpressuser"
#create has value is "password"
#Grant access right of to
GRANT ALL ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';
#Flush the changes you’ve made to make them available to the current MariaDB process
FLUSH PRIVILEGES;
#exit out of the MariaDB prompt to get back to your regular shell
exit
ចំណាំ:
As a goal of maintaining things simple, I’ve set the values as follows:
= wordpress
= ពាក្យសម្ងាត់
= wordpressuser
You should change these values to your liking, especially since the value for ត្រូវការពាក្យសម្ងាត់ខ្លាំង ហើយមិនងាយទាយបានឡើយ។
If you are still confused, please check out the video below
ជំហានទី 16: ដំឡើង និងកំណត់រចនាសម្ព័ន្ធ WordPress
We are now ready to download and install WordPress. Move to your home directory and download the latest version of WordPress by typing
#Move into the virtual host root directory
cd /usr/local/lsws/Example/html/
#Download wordpress
wget http://wordpress.org/latest.zip
#Extract the arrchive
unzip latest.zip
#Grant the webserver user write permission to create wp-config.php
chown -R nobody:nobody wordpress
Extract the archive and enter the directory by typing
tar xzvf latest.tar.gz
cd wordpress
You can copy the sample WordPress configuration file to wp-config.php
ឯកសារដែល WordPress ពិតជាអាន និងដំណើរការ។ នេះគឺជាកន្លែងដែលយើងនឹងដាក់ព័ត៌មានលម្អិតអំពីការភ្ជាប់មូលដ្ឋានទិន្នន័យរបស់យើង។
cp wp-config-sample.php wp-config.php
Open the configuration file so that we can add our database credentials
nano wp-config.php
You need to find the settings for DB_NAME, DB_USER, and DB_PASSWORD so that WordPress can authenticate and utilize the database that we already did in Step 2. Please replace these values with yours, not mine
#Put in Step 2 at here
define('DB_NAME', 'wordpress');
#Put in Step 2 at here
define('DB_USER', 'wordpressuser');
#Put in Step 2 at here
define('DB_PASSWORD', 'password');
Remember to save (បញ្ជា (Ctrl) + O) ហើយចេញ (បញ្ជា (Ctrl) + X) នៅពេលអ្នកបញ្ចប់
If you are still confused, please check out this video
Now, we are ready to copy the files into our document root. To do this, type
sudo cp -r ~/wordpress/* /usr/local/lsws/Example/html/
Give permission for the entire directory structure to the user that the web server runs under so that changes can be made through the WordPress interface
sudo chown -R nobody:nobody /usr/local/lsws/Example/html
ជំហានទី 17: បញ្ចប់ការដំឡើងតាមរយៈ WordPress Interface
We are now ready to download and install WordPress. Move to your home directory and download the latest version of WordPress by typing
cd ~
wget https://wordpress.org/latest.tar.gz
Give permission of the entire directory structure to the user that the web server runs under so that changes can be made through the WordPress interface