CentOS/RHEL 8/7 -ב MariaDB -ו PHP םע Lighttpd תא ןיקתהל דציכ


Lighttpd םירחא טנרטניא יתרשל האוושהב ןורכיז לוצינ תוחפ םע תוריהמל תויטירק תוביבסל דעוימה רתוי םאתומו שימג ,ריהמ ,חטבואמ ,חותפ דוק םע טנרטניא תרש אוה.

.דועו םירתא תובותכ תביתכ ,טלפ תסיחד ,FastCGI, SCGI, Auth ןוגכ תמדקתמ תונוכת תכרע םע עיגמו דבעמה סמוע לש ליעי לוהינ םע דחא תרשב םיליבקמ םירוביח 10,000 דע םע דדומתהל לוכי אוה

Lighttpd ה תיתשת לשב ,סקוניל תרש לכל ןיוצמ ןורתיפ אוה- io םירחא םייפולח טנרטניא יתרש םע רשאמ הרמוח התוא םע המכ יפ םיבוט םיעוציב לדוג תונשל ונל תרשפאמה ולש הריהמה.

.IP 192.168.0.103 תבותכו linux-console.net חראמה םש םע CentOS/RHEL 8/7 תוצפהב MariaDB -ו PHP, PHP-FPM םע Lighttpd תא ןיקתהל דציכ ריבסנ הז ךירדמב

Lighttpd טנרטניאה תרש תא ןקתה :1 בלש

.האבה yum תדוקפ תועצמאב םינימז םירגאמו ךלש תכרעמה תנכות תוליבח תא ןכדעל ךילע ,תישאר ,Lighttpd תא ןיקתהל ידכ .1

# yum -y update

.תואבה תודוקפה תועצמאב הנכות תוליבח ןכדעלו ךלש תכרעמב EPEL רגאמ ליעפהל ךילע ,ןכמ רחאל .2

# yum -y install epel-release
# yum -y update

.האבה הדוקפה תלעפה ידי לע Lighttpd תא ןיקתהל לכות תעכ ,EPEL רגאמ תא ליעפתש רחאל .3

# yum install lighttpd

.תואבה תודוקפה תועצמאב בצמה תא תמאל אדוולו לוחתאה ןמזב יטמוטוא ןפואב תורישה תא ליעפהלו ליחתהל ולכות ,Lighttpd -ה תוליבח תנקתה רחאל .4

# systemctl start lighttpd
# systemctl enable lighttpd
# systemctl status lighttpd

.האבה הדוקפה תועצמאב ךלש תכרעמב תנקתומה Lighttpd -ה תסרג תא תעכ קודב .5

# lighttpd -v

lighttpd/1.4.55 (ssl) - a light and fast webserver

.ךלש שאה תמוחב HTTPS -ו HTTP תרובעת רשפאל ךילע תעכ .6

# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --reload

.דבוע ךלש Lighttpd טנרטניאה תרש תוארל ידכ האבה רתאה תבותכ לע עיבצהו ךלש ןפדפדה תא חתפ תעכ .7

http://Your-Domain.com
OR
http://Your-IP-addr

.etc/lighttpd/lighttpd.conf/ תחת םקוממ ישארה הרוצתה ץבוקו/var/www/lighttpd/איה Lighttpd רובע לדחמ תרירבכ תרדגומה ךמסמה שרוש תיירפס

CentOS 7 -ב MySQL -כ MariaDB תנקתה :2 בלש

.תואבה תודוקפה תועצמאב Lighttpd רובע MySQL תכימת תא ןקתה ,ןכמ רחאל .8

# yum -y install mariadb mariadb-server

.תואבה תודוקפה תועצמאב MariaDB לש הבצמ תא תמאו לעפה ,לחתה ,הנקתהה םויס רחאל .9

# systemctl start mariadb.service
# systemctl enable mariadb.service
# systemctl status mariadb.service

.האבה הדוקפה תקפנה ידי לע ךלש MariaDB תנקתה תא חטבאל ךילע היהי ,ףוסבל .10

# mysql_secure_installation

.שרושל הסינכ תא קוחרמ תיבשהלו םיימינונא םישמתשמ תיבשהל ,הקידבל םינותנה דסמ תא תיבשהל ,םינותנה דסמ לש סיסבה שמתשמ תמסיס תא תונשל ךתורשפאב .התוא חטבאל הצרת דציכו ךלש MariaDB תנקתהל עגונב תונ

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!

.ףוסמב תואבה תודוקפה םע ךלש םינותנה דסמ תרשב םימייקה םינותנה ידסמ תא רוקסלו MySQL תרשל רבחתהל הסנ .11

# 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)]>

CentOS 7 -ב FastCGI םע PHP-FPM -ו PHP תנקתה :3 בלש

.האבה הדוקפה תועצמאב תושורדה תומויס םע דחי PHP ןיקתהל ךילע ,תישאר ,FastCGI -ב הכימת םע PHP-FPM רשפאל ידכ .12

# yum -y install php php-mysqlnd php-pdo php-gd php-mbstring

.הלאה תוליבחה תא םג ןיקתהל ךילע ךכ םשל ,Lighttpd רובע FastCGI -ו PHP-FPM -ב הכימת לעפה תעכ ,PHP תנקתה רחאל .13

# yum -y install php-fpm lighttpd-fastcgi

.etc/php-fpm.d/www.conf/ םשב ץבוק חתפ תעכ .14

# 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

:ךכ הארמל הנזאה הרושה תא ךופה .TCP רוביחב שמתשהל ידכב PHP-FPM רוציל ךילע ,var/run/php/php7.0-fpm.sock/ עקשב שמתשמ לדחמ תרירבכ PHP-FPM ,ןכ ומכ

;listen = /var/run/php/php7.0-fpm.sock
listen = 127.0.0.1:9000 

.תואבה תודוקפה תועצמאב לוחתאה ןמזב יטמוטוא ןפואב ליחתהל ול רשפאל אדוו PHP-FPM תורישב לחתה תעכ .15

# systemctl start php-fpm.service
# systemctl enable php-fpm.service

Lighttpd -ב FastCGI םע PHP-FPM -ו PHP תלעפה :4 בלש

.Lighttpd רובע PHP -ב הכימת רשפאל ידכ etc/lighttpd/conf.d/fastcgi.conf/ -ו etc/php.ini, /etc/lighttpd/modules.conf/ םיצבק השולש תונשל ונילע ןאכ .16

.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

Lighttpd -ב FastCGI -ב הכימת םע PHP-FPM -ו PHP תקידב :5 בלש

.וז הירפסל phpinfo.php ץבוק רוצינ ןאכ ,זא ./ var/www/lighttpd/אוה Lighttpd רובע לדחמ תרירבכ רדגומה ךמסמה שרוש ליעל ונרמאש יפכ .17

# vi /var/www/lighttpd/info.php

.םהיתואסרג םע PHP תנקתה לע עדימ גיצת וז הנטק דוק תסיפ .תואבה תורושה תא וילא ףסוה

<?php
phpinfo();
?>

.םיאבה םירושיקל טוונו ןפדפדה תא חתפ .18

http://Your-Domain.com/info.php
OR
http://Your-IP-addr/info.php

.םילעפומ רבכש םירחא םילודומ הברה םע MySQL -ו PHP, PHP-FPM לש הדובע עדימ הארת


כל הזכויות שמורות. © Linux-Console.net • 2019-2024