CentOS/RHEL 8/7-ൽ PHP, MariaDB എന്നിവ ഉപയോഗിച്ച് Lighttpd എങ്ങനെ ഇൻസ്റ്റാൾ ചെയ്യാം
മറ്റ് വെബ് സെർവറുകളെ അപേക്ഷിച്ച് കുറഞ്ഞ മെമ്മറി ഉപയോഗമുള്ള സ്പീഡ് ക്രിട്ടിക്കൽ പരിതസ്ഥിതികൾക്കായി രൂപകൽപ്പന ചെയ്ത ഒരു ഓപ്പൺ സോഴ്uസ്, സുരക്ഷിതവും, വേഗതയേറിയതും, വഴക്കമുള്ളതും, കൂടുതൽ ഒപ്റ്റിമൈസ് ചെയ്തതുമായ വെബ് സെർവറാണ് Lighttpd.
ഫലപ്രദമായ സിപിയു-ലോഡ് മാനേജ്uമെന്റ് ഉപയോഗിച്ച് ഒരു സെർവറിൽ സമാന്തരമായി 10,000 കണക്ഷനുകൾ വരെ കൈകാര്യം ചെയ്യാൻ ഇതിന് കഴിയും, കൂടാതെ FastCGI, SCGI, Auth, Output-Compression, URL-Rewriting എന്നിവയും അതിലേറെയും പോലുള്ള വിപുലമായ ഫീച്ചർ സെറ്റുമായി വരുന്നു.
മറ്റ് ഇതര വെബ്-സെർവറുകളേക്കാൾ ഒരേ ഹാർഡ്uവെയർ ഉപയോഗിച്ച് നിരവധി മടങ്ങ് മികച്ച പ്രകടനം അളക്കാൻ ഞങ്ങളെ അനുവദിക്കുന്ന അതിവേഗ ഐഒ ഇൻഫ്രാസ്ട്രക്ചർ കാരണം, എല്ലാ ലിനക്സ് സെർവറിനുമുള്ള മികച്ച പരിഹാരമാണ് Lighttpd.
ഈ ട്യൂട്ടോറിയലിൽ, CentOS/RHEL 8/7 വിതരണങ്ങളിൽ PHP, PHP-FPM, MariaDB എന്നിവ ഉപയോഗിച്ച് Lighttpd എങ്ങനെ ഇൻസ്റ്റാൾ ചെയ്യാമെന്ന് ഞങ്ങൾ വിശദീകരിക്കും, ഹോസ്റ്റ്നാമമായ linux-console.net, IP വിലാസം 192.168.0.103 എന്നിവ.
ഘട്ടം 1: Lighttpd വെബ് സെർവർ ഇൻസ്റ്റാൾ ചെയ്യുക
1. Lighttpd ഇൻസ്റ്റാൾ ചെയ്യുന്നതിന്, ആദ്യം, താഴെ പറയുന്ന yum കമാൻഡ് ഉപയോഗിച്ച് നിങ്ങളുടെ സിസ്റ്റം സോഫ്റ്റ്uവെയർ പാക്കേജുകളും ലഭ്യമായ ശേഖരണങ്ങളും അപ്ഡേറ്റ് ചെയ്യേണ്ടതുണ്ട്.
# yum -y update
2. അടുത്തതായി, നിങ്ങളുടെ സിസ്റ്റത്തിൽ EPEL റിപ്പോസിറ്ററി പ്രവർത്തനക്ഷമമാക്കുകയും താഴെ പറയുന്ന കമാൻഡുകൾ ഉപയോഗിച്ച് സോഫ്റ്റ്uവെയർ പാക്കേജുകൾ അപ്ഡേറ്റ് ചെയ്യുകയും വേണം.
# yum -y install epel-release # yum -y update
3. നിങ്ങൾ EPEL റിപ്പോസിറ്ററി പ്രവർത്തനക്ഷമമാക്കിയാൽ, ഇനിപ്പറയുന്ന കമാൻഡ് പ്രവർത്തിപ്പിച്ച് നിങ്ങൾക്ക് ഇപ്പോൾ Lighttpd ഇൻസ്റ്റാൾ ചെയ്യാൻ കഴിയും.
# yum install lighttpd
4. Lighttpd പാക്കേജുകൾ ഇൻസ്റ്റാൾ ചെയ്തുകഴിഞ്ഞാൽ, ബൂട്ട് സമയത്ത് സ്വയമേവ ആരംഭിക്കുന്നതിന് നിങ്ങൾക്ക് സേവനം ആരംഭിക്കാനും പ്രവർത്തനക്ഷമമാക്കാനും കഴിയും കൂടാതെ ഇനിപ്പറയുന്ന കമാൻഡുകൾ ഉപയോഗിച്ച് സ്റ്റാറ്റസ് സ്ഥിരീകരിക്കുന്നത് ഉറപ്പാക്കുക.
# systemctl start lighttpd # systemctl enable lighttpd # systemctl status lighttpd
5. ഇപ്പോൾ താഴെ പറയുന്ന കമാൻഡ് ഉപയോഗിച്ച് നിങ്ങളുടെ സിസ്റ്റത്തിൽ ഇൻസ്റ്റാൾ ചെയ്ത Lighttpd പതിപ്പ് പരിശോധിക്കുക.
# lighttpd -v lighttpd/1.4.55 (ssl) - a light and fast webserver
6. ഇപ്പോൾ നിങ്ങളുടെ ഫയർവാളിൽ HTTP, HTTPS ട്രാഫിക്ക് അനുവദിക്കേണ്ടതുണ്ട്.
# firewall-cmd --permanent --zone=public --add-service=http # firewall-cmd --permanent --zone=public --add-service=https # firewall-cmd --reload
7. ഇപ്പോൾ നിങ്ങളുടെ ബ്രൗസർ തുറന്ന് നിങ്ങളുടെ Lighttpd വെബ്uസെർവർ പ്രവർത്തിക്കുന്നത് കാണുന്നതിന് ഇനിപ്പറയുന്ന URL-ലേക്ക് പോയിന്റ് ചെയ്യുക.
http://Your-Domain.com OR http://Your-IP-addr
Lighttpd-നുള്ള ഡിഫോൾട്ട് ഡോക്യുമെന്റ് റൂട്ട് ഡയറക്uടറി /var/www/lighttpd/ ആണ്, പ്രധാന കോൺഫിഗറേഷൻ ഫയൽ /etc/lighttpd/lighttpd.conf എന്നതിന് കീഴിലാണ് സ്ഥിതി ചെയ്യുന്നത്.
ഘട്ടം 2: CentOS 7-ൽ MySQL ആയി MariaDB ഇൻസ്റ്റാൾ ചെയ്യുന്നു
8. അടുത്തതായി, ഇനിപ്പറയുന്ന കമാൻഡുകൾ ഉപയോഗിച്ച് Lighttpd-നായി MySQL പിന്തുണ ഇൻസ്റ്റാൾ ചെയ്യുക.
# yum -y install mariadb mariadb-server
9. ഇൻസ്റ്റാളേഷൻ പൂർത്തിയായിക്കഴിഞ്ഞാൽ, ഇനിപ്പറയുന്ന കമാൻഡുകൾ ഉപയോഗിച്ച് MariaDB-യുടെ സ്റ്റാറ്റസ് ആരംഭിക്കുക, പ്രവർത്തനക്ഷമമാക്കുക, സ്ഥിരീകരിക്കുക.
# systemctl start mariadb.service # systemctl enable mariadb.service # systemctl status mariadb.service
10. അവസാനമായി, ഇനിപ്പറയുന്ന കമാൻഡ് നൽകി നിങ്ങളുടെ MariaDB ഇൻസ്റ്റാളേഷൻ സുരക്ഷിതമാക്കേണ്ടതുണ്ട്.
# mysql_secure_installation
നിങ്ങളുടെ MariaDB ഇൻസ്റ്റാളേഷനെക്കുറിച്ചും അത് എങ്ങനെ സുരക്ഷിതമാക്കാൻ നിങ്ങൾ ആഗ്രഹിക്കുന്നു എന്നതിനെക്കുറിച്ചും വ്യത്യസ്തമായ കുറച്ച് ചോദ്യങ്ങൾ നിങ്ങളോട് ആവശ്യപ്പെടും. നിങ്ങൾക്ക് ഡാറ്റാബേസ് റൂട്ട് യൂസർ പാസ്uവേഡ് മാറ്റാനും ടെസ്റ്റ് ഡാറ്റാബേസ് പ്രവർത്തനരഹിതമാക്കാനും അജ്ഞാത ഉപയോക്താക്കളെ പ്രവർത്തനരഹിതമാക്കാനും റൂട്ട് ലോഗിൻ വിദൂരമായി പ്രവർത്തനരഹിതമാക്കാനും കഴിയും.
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none):Enter
OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorization. Set root password? [Y/n]y
New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n]y
... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n]y
... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing and should be removed before moving into a production environment. Remove test database and access to it? [Y/n]y
- Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n]y
... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
11. MySQL സെർവറിലേക്ക് കണക്റ്റുചെയ്യാൻ ശ്രമിക്കുക, ടെർമിനലിൽ ഇനിപ്പറയുന്ന കമാൻഡുകൾ ഉപയോഗിച്ച് നിങ്ങളുടെ ഡാറ്റാബേസ് സെർവറിൽ നിലവിലുള്ള ഡാറ്റാബേസുകൾ അവലോകനം ചെയ്യുക.
# mysql -u root -p
Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 10 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 3 rows in set (0.00 sec) MariaDB [(none)]>
ഘട്ടം 3: CentOS 7-ൽ FastCGI ഉപയോഗിച്ച് PHP, PHP-FPM എന്നിവ ഇൻസ്റ്റാൾ ചെയ്യുന്നു
12. FastCGI പിന്തുണയോടെ PHP-FPM പ്രവർത്തനക്ഷമമാക്കുന്നതിന്, ആദ്യം, ഇനിപ്പറയുന്ന കമാൻഡ് ഉപയോഗിച്ച് ആവശ്യമായ എക്സ്റ്റൻഷനുകൾക്കൊപ്പം PHP ഇൻസ്റ്റാൾ ചെയ്യേണ്ടതുണ്ട്.
# yum -y install php php-mysqlnd php-pdo php-gd php-mbstring
13. PHP ഇൻസ്റ്റാൾ ചെയ്തുകഴിഞ്ഞാൽ, ഇപ്പോൾ Lighttpd-നുള്ള PHP-FPM, FastCGI പിന്തുണ എന്നിവ പ്രവർത്തനക്ഷമമാക്കുക, ഇത് ചെയ്യുന്നതിന് നിങ്ങൾ ഈ പാക്കേജുകളും ഇൻസ്റ്റാൾ ചെയ്യേണ്ടതുണ്ട്.
# yum -y install php-fpm lighttpd-fastcgi
14. ഇപ്പോൾ /etc/php-fpm.d/www.conf എന്ന ഫയൽ തുറക്കുക.
# vi /etc/php-fpm.d/www.conf
ഉപയോക്താവിനെയും ഗ്രൂപ്പിനെയും Lighttpd ആയി സജ്ജമാക്കുക.
; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. ; RPM: apache Choosed to be able to access some dir as httpd user = lighttpd ; RPM: Keep a group allowed to write in log dir. group = lighttpd
കൂടാതെ, PHP-FPM സ്ഥിരസ്ഥിതിയായി /var/run/php/php7.0-fpm.sock സോക്കറ്റ് ഉപയോഗിക്കുന്നു, ഒരു TCP കണക്ഷൻ ഉപയോഗിക്കുന്നതിന് നിങ്ങൾ PHP-FPM നിർമ്മിക്കേണ്ടതുണ്ട്. ശ്രവിക്കുക
വരി ഇതുപോലെയാക്കുക:
;listen = /var/run/php/php7.0-fpm.sock listen = 127.0.0.1:9000
15. ഇപ്പോൾ PHP-FPM സേവനം ആരംഭിക്കുക, താഴെ പറയുന്ന കമാൻഡുകൾ ഉപയോഗിച്ച് ബൂട്ട് സമയത്ത് അത് യാന്ത്രികമായി ആരംഭിക്കുന്നത് ഉറപ്പാക്കുക.
# systemctl start php-fpm.service # systemctl enable php-fpm.service
ഘട്ടം 4: Lighttpd-ൽ FastCGI ഉപയോഗിച്ച് PHP, PHP-FPM എന്നിവ പ്രവർത്തനക്ഷമമാക്കുന്നു
16. ഇവിടെ, Lighttpd-നുള്ള PHP പിന്തുണ പ്രവർത്തനക്ഷമമാക്കാൻ ഞങ്ങൾ മൂന്ന് ഫയലുകൾ /etc/php.ini, /etc/lighttpd/modules.conf, /etc/lighttpd/conf.d/fastcgi.conf എന്നിവ പരിഷ്uക്കരിക്കേണ്ടതുണ്ട്.
ആദ്യ ഫയൽ തുറക്കുക /etc/php.ini.
# vi /etc/php.ini
cgi.fix_pathinfo=1 എന്ന് പറയുന്ന വരികൾ അൺ-കമന്റ് ചെയ്യുക.
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's ; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok ; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting ; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting ; of zero causes PHP to behave as before. Default is 1. You should fix your scripts ; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. ; http://php.net/cgi.fix-pathinfo cgi.fix_pathinfo=1
തുടർന്ന് /etc/lighttpd/modules.conf എന്ന രണ്ടാമത്തെ ഫയൽ തുറക്കുക.
# vi /etc/lighttpd/modules.conf
“conf.d/fastcgi.conf” ഉൾപ്പെടുന്ന ഇനിപ്പറയുന്ന വരി അൺ-കമന്റ് ചെയ്യുക.
## ## FastCGI (mod_fastcgi) ## include "conf.d/fastcgi.conf"
അടുത്തതായി, /etc/lighttpd/conf.d/fastcgi.conf എന്ന മൂന്നാമത്തെ ഫയൽ തുറക്കുക.
# vi /etc/lighttpd/conf.d/fastcgi.conf
ഇപ്പോൾ ഫയലിന്റെ അടിയിൽ ഇനിപ്പറയുന്ന കണ്ടെയ്നർ ചേർത്ത് സേവ് ചെയ്യുക.
fastcgi.server += ( ".php" => (( "host" => "127.0.0.1", "port" => "9000", "broken-scriptfilename" => "enable" )) )
മാറ്റങ്ങൾ പ്രതിഫലിപ്പിക്കുന്നതിനും PHP പിന്തുണ പ്രവർത്തനക്ഷമമാക്കുന്നതിനും Lighttpd സേവനം പുനരാരംഭിക്കുക.
# systemctl restart lighttpd
ഘട്ടം 5: Lighttpd-ൽ FastCGI പിന്തുണയോടെ PHP, PHP-FPM എന്നിവ പരിശോധിക്കുന്നു
17. ഞങ്ങൾ മുകളിൽ പറഞ്ഞതുപോലെ, Lighttpd-യുടെ സ്ഥിരസ്ഥിതി പ്രമാണ റൂട്ട് /var/www/lighttpd/ ആണ്. അതിനാൽ, ഇവിടെ നമ്മൾ ഈ ഡയറക്ടറിയിൽ ഒരു phpinfo.php ഫയൽ സൃഷ്ടിക്കും.
# vi /var/www/lighttpd/info.php
അതിൽ താഴെ പറയുന്ന വരികൾ ചേർക്കുക. ഈ ചെറിയ കോഡ് PHP ഇൻസ്റ്റാളേഷനെക്കുറിച്ചുള്ള വിവരങ്ങൾ അവയുടെ പതിപ്പുകൾക്കൊപ്പം പ്രദർശിപ്പിക്കും.
<?php phpinfo(); ?>
18. നിങ്ങളുടെ ബ്രൗസർ തുറന്ന് ഇനിപ്പറയുന്ന ലിങ്കുകളിലേക്ക് നാവിഗേറ്റ് ചെയ്യുക.
http://Your-Domain.com/info.php OR http://Your-IP-addr/info.php
ഇതിനകം പ്രവർത്തനക്ഷമമാക്കിയിട്ടുള്ള നിരവധി മൊഡ്യൂളുകൾക്കൊപ്പം PHP, PHP-FPM, MySQL എന്നിവയുടെ പ്രവർത്തന വിവരങ്ങൾ നിങ്ങൾ കാണും.