Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Site na mmụba nke nyiwe mgbasa ozi mmekọrịta dịka Reddit, Facebook, Twitter na nyiwe nkata n'ịntanetị dị ka esemokwu, anyị ahụla ka obodo ọgbakọ mgbasa ozi ịntanetị na-ebelata. Onwe ya, dị ka m kwuru, ha na-eji nwayọọ nwayọọ na-alọghachi na mpaghara niche akọwapụtara maka mgbakwunye ọhụrụ. phpBB bụ otu n'ime ngwa mgbasa ozi ọgbakọ mepere emepe kachasị agbatị n'ahịa.

phpBB abụghị naanị nhọrọ. Ndị ọzọ dị ka VBulletin, Nodebb, Xenforo, na ndị ọzọ, mana ọtụtụ n'ime ihe ndị a na-akwụ ụgwọ site na nlele anya. VBulletin bụbu ụlọ ike, mana ugbu a ọ bụ onyinyo nke onwe ya mbụ. Xenforo bụ otu n'ime ngwa nbipụta akwụkwọ akụkọ kacha akwụ ụgwọ kacha mma. Agbanyeghị, nke ahụ bụ naanị echiche nke m, mana m ga-ebu ụzọ họrọ phpBB mgbe niile ka ọ bụ n'efu, mepere emepe, yana nwee ụfọdụ ndị mmepe mepere emepe 3rd ọzọ, ma devs ọhụrụ na nke dị kemgbe mmalite.

N'ime nkuzi na-esote, ị ga-amụta ka esi etinye LEMP site na iji ngwugwu ndabara sitere na Rocky Linux 8 App stream ma ọ bụ ngwugwu ọzọ sitere na ebe nchekwa EPEL, yana ịtọlite ​​​​phpBB maka iji oge mbụ na Rocky Linux 8.

Prerequisites

  • OS akwadoro: Rocky Linux 8.+.
  • Akaụntụ onye ọrụ: Akaụntụ onye ọrụ nwere sudo ma ọ bụ ohere mgbọrọgwụ.

Melite Sistemụ Ọrụ

Melite gi Nkume linux Sistemụ arụmọrụ iji hụ na ngwugwu niile dị adị adịla ugbu a:

sudo dnf upgrade --refresh -y

Nkuzi a ga-eji ya sudo iwu na na-eche na ị nwere ọnọdụ sudo.

Iji nyochaa ọkwa sudo na akaụntụ gị:

sudo whoami

Ihe atụ na-egosi ọkwa sudo:

[joshua@rockylinux ~]$ sudo whoami
root

Ka ịtọlite ​​akaụntụ sudo dị adị ma ọ bụ ọhụrụ, gaa na nkuzi anyị na Otu esi etinye onye ọrụ na Sudoers na Rocky Linux.

Iji mgbọrọgwụ akaụntụ, jiri iwu na-esonụ na paswọọdụ mgbọrọgwụ banye.

su

Advertisement


Nhọrọ. Wụnye ebe nchekwa EPEL

Nzọụkwụ mbụ bụ ibubata ebe nchekwa site na EPEL (Ngwugwu ndị ọzọ maka Linux Enterprise). Ebe nchekwa a ga-enye gị ohere ịwụnye ngwugwu dị iche iche na Rocky Linux 8 App Stream nhọrọ. Ọtụtụ mgbe, ụfọdụ n'ime ndị a bụ ndị ọhụrụ mgbe n'otu oge ahụ incredibly kwụsiri ike ma e jiri ya tụnyere ịwụnye ngwungwu mbepụ zuru oke ozugbo site na isi iyi.

sudo dnf install epel-release

Ihe atụ mmepụta:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ụdị "Y," wee pịa "Tinye igodo" ịga n'ihu na ntinye. Mara, a ga-akpali gị ka ibubata ihe igodo GPG ọ bụrụ na ị na-etinye site na EPEL ma ọ bụ ebe nchekwa ọzọ, pịnye "Y" ọ bụrụ na nke a emee.

Ọ na-adị mma mgbe niile iji nyochaa ma agbakwunyere ebe nchekwa ahụ nke ọma; nke a nwere ike ime na dnf repolist iwu dị ka n'okpuru:

sudo dnf repolist

Ihe atụ mmepụta:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Dịka ị na-ahụ, a na-agbakwunye ebe nchekwa EPEL nke ọma. Ngosipụta dị mma, ị nwere ike iji iwu a ọzọ iji hụ mbubata ebe nchekwa ọ bụla n'ọdịnihu.

Wụnye Nginx - (LEMP Stack)

Nhọrọ. Gbanwee ụdị Nginx ka ọ bụrụ EPEL

Iji malite nrụnye nchịkọta LEMP, ị ga-achọ ịwụnye ya Nginx sava weebụ. Nkuzi a ga-egosi nhọrọ nhọrọ nke iyi Nginx ka ịwụnye, nke dị mma ma ọ bụrụ na ị tinye ebe nchekwa EPEL.

Mbụ, depụta profaịlụ Nginx dị site na iji dnf modul ndepụta iwu n'ọnụ ọnụ gị:

sudo dnf module list nginx

Ihe atụ mmepụta:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ebe nkuzi a na-elekwasị anya n'iji ntọhapụ EPEL, a ga-ahọrọ Nginx mainline. Mana nke mbụ, ịkwesịrị ịtọgharịa modul Nginx ka ọ gbanwee.

sudo dnf module reset nginx

Ihe atụ mmepụta:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ụdị "Y," wee pịa "Tinye igodo" ka ịga n'ihu na ịtọgharịa ndepụta modul.

Na-esote, mee ka modul Nginx masịrị gị. Maka nkuzi a, a ga-ahọrọ EPEL, ma ọ bụrụ na ịchọrọ iji Nginx mainline, ị ga-abanye "nginx: mainline," ọ bụrụ na ịchọrọ ụdị kwụsiri ike, mgbe ahụ ọ ga-abụ “nginx.1:20”.

Iji tinye EPEL mainline:

sudo dnf module enable nginx:mainline

Iji wụnye ụlọ EPEL:

sudo dnf module enable nginx:1.20

Wụnye Nginx

Ugbu a ọ bụ oge ịwụnye Nginx dị ka akụkụ nke nrụnye LEMP. Ma ị tinyela EPEL na iji Nginx wuru dabere na ebe nchekwa ahụ ma ọ bụ jiri ndabara Rocky Linux 8 App iyi, iwu ga-abụ otu; naanị ụfọdụ n'ime nsonaazụ ndị bụ naanị ihe atụ ga-adị iche.

Iji tinye Nginx, jiri iwu na-esonụ na njedebe gị:

sudo dnf install nginx

Ihe atụ mmepụta:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ụdị "Y," wee pịa "Tinye igodo" ịga n'ihu na nwụnye.

Kwado nrụnye site na ịlele ụdị nrụpụta:

nginx -v

Ihe atụ mmepụta:

nginx version: nginx/1.14.1

Site na ndabara, mgbe ị na-etinye Nginx na Rocky Linux, anaghị enyere ya aka. Iji mee ka boot na ịmalite, jiri ihe ndị a:

sudo systemctl enable nginx --now

Ọmụmaatụ nke iji mee nke ọma (symlink):

Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.

Ugbu a, lelee ka ịhụ ọkwa ọrụ Nginx gị site na iji iwu ọnụ na-esonụ:

systemctl status nginx

Ihe atụ na-ekwu na ihe niile dị mma:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ugbu a, ị nwere ike kwado na sava weebụ Nginx gị na-arụ ọrụ site na ịbanye HTTP://server-ip or HTTP: // ngalaba-aha na ihe nchọgharị ịntanetị gị, ị ga-enweta ihe ndị a:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ọ bụrụ na ịnweghị ike ịnweta ibe a, ị nwere ike ịhazi ntọala firewall kpuchiri na ngalaba na-esote.


Advertisement


Hazie Iwu Firewall

Ọ naghị agbakwunye iwu firewall na akpaghị aka na ọdụ ụgbọ mmiri 80 ma ọ bụ 443 mgbe ị na-etinye Nginx. Tupu ị gaa n'ihu, ịkwesịrị ịtọ iwu ndị a, nke a ga-adabere na ọdụ ụgbọ mmiri ị ga-eji, mana edepụtara nhọrọ niile.

Mepee ọdụ ụgbọ mmiri 80 ma ọ bụ HTTP:

sudo firewall-cmd --permanent --zone=public --add-service=http

Mepee ọdụ ụgbọ mmiri 443 ma ọ bụ HTTPS:

sudo firewall-cmd --permanent --zone=public --add-service=https

Bugharịa firewall iji mee mgbanwe ka ọ dị irè

sudo firewall-cmd --reload

Wụnye MariaDB (LEMP STACK)

Nhọrọ. Gbanwee na MariaDB 10.5

Rocky Linux App iyi site na ndabara wụnye MariaDB 10.3, ụdị ochie mana kwụsiri ike nke ukwuu. Otú ọ dị, MariaDB kachasị ọhụrụ n'oge nkuzi a nke a na-ahazi dị ka ntọhapụ kwụsiri ike bụ MariaDB 10.6.4. Dị ka ị nwere ike iche n'echiche, ọdịiche ahụ dị ịrịba ama; Otú ọ dị, dị ka ọtụtụ ndị ọrụ nke Rocky Linux na-ahọrọ iji nkwụsi ike n'elu mbepụ ọnụ, ihe ngwọta ga-abụ iji MariaDB 10.5 nke dị ọhụrụ ma n'otu oge ahụ na-akwụsi ike ma na-enweta mmezi ahụhụ na mmelite nche.

Mbụ, tọgharịa ndepụta MariaDB modul:

sudo dnf module reset mariadb

Ihe atụ mmepụta:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ụdị "Y," wee pịa "Tinye igodo" ka ịga n'ihu na nrụpụta modul.

Na-esote, mee ka MariaDB 10.5 bụrụ isi mmalite mgbe ị na-etinye MariaDB.

sudo dnf module enable mariadb:10.5

Ihe atụ mmepụta:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ụdị "Y," wee pịa "Tinye igodo" ka ịga n'ihu na modul gbanwee gaa na MariaDB 10.5.

Tinye MariaDB

Ugbu a, ọ bụ oge iji wụnye MariaDB; dabere n'ụdị ị họọrọ, nsonaazụ ya nwere ike ịdị iche, mana iwu ga-abụ otu.

sudo dnf install mariadb-server mariadb

Ihe atụ mmepụta:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ụdị "Y," wee pịa "Tinye igodo" ịga n'ihu na nwụnye.

Iji kwado nrụnye nke MariaDB yana ịlele ihe arụnyere arụnyere, pịnye iwu a:

mysql --version

Ihe atụ mmepụta:

mysql  Ver 15.1 Distrib 10.5.9-MariaDB, for Linux (x86_64) using  EditLine wrapper

Lelee ọkwa nkesa MariaDB

Ugbu a ị tinyela MariaDB, ị nwere ike nyochaa ọnọdụ nke ngwanrọ nchekwa data site na iji usoro systemctl na-esonụ:

systemctl status mariadb

Site na ndabara, ị ga-ahụ ọkwa MariaDB ka ọ kwụsịrị. Iji malite MariaDB, jiri iwu a:

sudo systemctl enable mariadb --now

Ugbu a lelee ọkwa ahụ, ma ị ga-enweta ihe ndị a:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Iji kwụsị MariaDB:

sudo systemctl stop mariadb

Iji mee ka MariaDB nwee ike na mmalite sistemụ:

sudo systemctl enable mariadb

Iji gbanyụọ MariaDB na mmalite sistemụ:

sudo systemctl disable mariadb

Ka ịmalitegharịa ọrụ MariaDB:

sudo systemctl restart mariadb

Chekwaa MariaDB site na iji script nchekwa

Mgbe ị wụnye MariaDB Ọhụrụ, ntọala ndabara ka a na-ewere dị ka adịghị ike site n'ọtụtụ ụkpụrụ ma na-ebute nchegbu maka ike ikwe ka mbubata ma ọ bụ na-erigbu ndị hackers. A ngwọta bụ na-agba ọsọ nwụnye nche script na-abịa na MariaDB ndozi.

Mbụ, jiri iwu na-esonụ iji malite (mysql_secure_installation):

sudo mysql_secure_installation

Na-esote, a ga-enye gị ngwa ngwa na-arịọ gị ka ịbanye (MariaDB mgbọrọgwụ paswọọdụ). Maka ugbu a, pịa ( Tinye) igodo ka edobeghi mgbọrọgwụ okwuntughe dị ka n'okpuru:

Ọzọ, ụdị (NA) wee pịa tinye ka ịtọlite ​​​​ (mgbọrọgwụ) paswọọdụ dị ka n'okpuru:

Usoro ajụjụ ndị ọzọ ị nwere ike ịkụ n'enweghị nsogbu ( Tinye), nke ga-aza (NA) nye ajụjụ niile na-esote nke na-ajụ gị (wepụ ndị ọrụ na-amaghị aha, gbanyụọ nbanye mgbọrọgwụ dịpụrụ adịpụ, wee wepụ nchekwa data ule). Rịba ama (NA) bụ isi, nke pụtara na ọ bụ azịza ndabara mgbe ị pịa ya ( Tinye) isi.

Ọmụmaatụ n'okpuru:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Nchịkọta nke ihe kwesịrị ka eme n'elu:

  • Ịtọ ntọala paswọọdụ maka mgbọrọgwụ akaụntụ.
  • Iwepu akaụntụ mgbọrọgwụ nke a na-enweta site na mpụga onye ọbịa mpaghara.
  • Iwepu akaụntụ onye ọrụ amaghị aha.
  • Iwepu nchekwa data ule, nke ndị ọrụ amaghị aha nwere ike ịnweta na ndabara.

Nzọụkwụ a dị mkpa maka nchekwa nchekwa data MariaDB na e kwesịghị ịgbanwe ma ọ bụ wụpụ ọ gwụla ma ịmara ihe ị na-eme.


Advertisement


Wụnye PHP & PHP-FPM (LEMP STACK)

Nhọrọ. Bubata ebe nchekwa PHP 8.0

Akụkụ ikpeazụ ịwụnye na nrụnye LEMP gị bụ PHP. Ị ga-achọ ịwụnye (PHP-FPM) nke dị mkpụmkpụ maka (Onye njikwa usoro FastCGI). A na-atụ aro ka ịwụnye PHP (Remi) ebe nchekwa. Maka ndị na-amaghị, Remi bụ onye na-ahụ maka mwepụta PHP na ezinụlọ Rhel.

Maka nkuzi a, anyị ga-etinye PHP 8.0 kacha ọhụrụ. Otú ọ dị, a ghaghị ịmara ya mgbe phpBB na-arụ ọrụ nke ọma na PHP 8.0 na elu, ụfọdụ n'ime plugins nwere ike iche nsogbu ihu, ya mere jide n'aka na ị na-etinye naanị plugins na-arụ ọrụ na emelitere nke kwesịrị ịbụ ọkọlọtọ na CMS ọ bụla. Ọ bụrụ na ị zutere nsogbu, wepụ PHP 8.0, wee jiri PHP 7.4.

Iji tinye PHP site na ebe nchekwa Remi, ị ga-achọ itinye ebe nchekwa EPEL na mmalite nkuzi. Site na ndabara, PHP 7.2 bụ nhọrọ PHP ndabara maka nrụnye ọkọlọtọ na Rocky Linux. Ndụmọdụ dị ngwa bụ iji (depụta php) iwu ka ịhụ nhọrọ dị na ndabara.

nwee (Nchekwa Remi) ya na ndi a:

sudo dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm

Ọzọ dị ka ihe atụ mmepụta, pịnye (NA) wee banye ka gaba n'ihu:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ọzọ, jiri (dnf) iwu ka imelite ndepụta nchekwa gị:

sudo dnf update

Ugbu a depụta modul dị maka PHP site na iji iwu a:

sudo dnf module list php

Ị ga-enweta ihe mmepụta dị ka n'okpuru. Rịba ama (d) mkpado maka ndabere PHP ka etinyere:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Dịka ị nwere ike ịhụ n'elu, na (d) mkpado dị n'akụkụ PHP 7.2, nke ị ga-achọ ịtọgharịa ma gbanwee ka ị malite ịwụnye PHP 8.0 na Rocky Linux. Ịtọgharịa ndepụta PHP dị mfe site na iwu a:

sudo dnf module list reset php

Na-esote, mee ka PHP 8.0 jiri iwu a:

sudo dnf module enable php:remi-8.0 

Mara, gị nwere ike ime PHP-7.4 site n'ịgbaso dnf modul nrụpụta iwu na iji ya dnf modul mee ka php: remi-7.4 iwu kama. ahọrọ ụdị ịchọrọ maka ngwa ahụ, nke a bụ naanị ọmụmaatụ nke ịnwe ụdị PHP kachasị ọhụrụ nke nhọrọ PHP ọ bụla ị kpebiri.

Wụnye PHP & PHP-FPM

Ọzọ, wụnye PHP na nkesa gị; dabere na ụdị nke PHP, ihe nrụpụta ga-adị iche; Otú ọ dị, iwu na-adị otu.

sudo dnf install php

Ihe atụ mmepụta:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ụdị "Y," wee pịa "Tinye igodo" ịga n'ihu na ntinye. Mara, enwere ike ịkpali gị pịnye "Y."

Nyochaa nwụnye ma lelee ụdị ma wuo:

php -v

Ihe atụ mmepụta:

PHP 8.0.11 (cli) (built: Sep 21 2021 17:07:44) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.11, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.11, Copyright (c), by Zend Technologies

Ugbu a, site na ndabara, PHP-FPM agbanyụrụ na anaghị enyere ya aka na buut. Iji mee ka boot na malite ọrụ, jiri ihe ndị a systemctl nyere iwu:

sudo systemctl enable php-fpm --now

Iji gosi na PHP-FPM na-agba ọsọ ugbu a, jiri ihe ndị a systemctl iwu:

Ihe atụ mmepụta:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Cheta, ịkwesighi iji PHP 8.0, mee nyocha ma ọ bụrụ na ị maghị, ma ọ bụ ka mma, jụọ na phpBB Community forums, nke na-arụ ọrụ kacha mma ugbu a; Otú ọ dị, usoro a bụ otu ihe ahụ yana iwu iji jiri ndabara ma ọ bụ nsụgharị ọzọ dị na ndepụta dnf modul.

Ugbu a edobere LEMP, gaba na nrụnye phpBB n'ezie.

Part 1. phpBB Backend nwụnye

Ugbu a ị wụnyela nchịkọta LEMP, ị nwere ike ịga n'ihu ịwụnye forums phpBB. N'ime oge nkuzi a, phpBB 3.3.4 bụ ụdị kachasị ọhụrụ, mana ka oge na-aga, dị ka ọtụtụ ihe, nke a ga-agbanwe ka ha na-eme ntọhapụ kwa ọnwa isii. Lelee ibe nbudata iji nyochaa na njikọ ụdị ka dị irè.

Budata & Ntọala ndekọ

Nkuzi a ga-achọta ndekọ ndekọ mgbọrọgwụ phpbb na ebe ahụ /var/www/html/phpbb. Site na ndabara, ọnọdụ a adịghị na Rocky Linux 8, yabụ ị ga-ebu ụzọ mepụta ebe ahụ site na iwu na-esonụ.

sudo mkdir -p /var/www/html/phpbb

Na-esote, gaa n'ihu budata phpBB wee bugharịa faịlụ n'ime ndekọ phpbb:

cd /tmp && wget https://download.phpbb.com/pub/release/3.3/3.3.4/phpBB-3.3.4.zip
unzip phpBB-3.3.4.zip
sudo mv phpBB3 /var/www/html/phpbb

Ugbu a, anyị kwesịrị ịgbanwe ikike ndekọ maka NGINX:

sudo chown -R $user:$user /var/www/html/phpbb
sudo chmod -R 755 /var/www/html/phpbb

Nhazi MariaDB

Ugbu a, ị na-aga n'ihu ịmepụta nchekwa data maka nrụnye phpBB gị na bọọdụ mgbasa ozi n'ọdịnihu.

Nke mbụ, weta ihe atụ njedebe MariaDB dị ka mgbọrọgwụ:

sudo mysql -u root -p

Mepụta nchekwa data maka ọgbakọ gị:

CREATE DATABASE phpbb;

Mepụta onye ọrụ nchekwa data akpọrọ phpbbuser nwere paswọọdụ ọhụrụ:

CREATE USER 'phpbbuser'@'localhost' IDENTIFIED BY 'new_password_here';

Mgbe ahụ nye onye ọrụ ohere ịnweta nchekwa data zuru oke site n'ime ihe ndị a:

GRANT ALL ON phpbb.* TO 'phpbbuser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;

Wepu ihe ùgwù ndị a iji mee mgbanwe ndị ahụ ka ọ rụọ ọrụ:

FLUSH PRIVILEGES;

Ugbu a pụọ:

EXIT;

Ebe nchekwa data gị maka phpBB adịla njikere, ma ị ga na-abanye nkọwa ahụ ozugbo ị nwetara akụkụ nrụnye UI weebụ nke nkuzi.

Nhazi PHP

Iji wụnye phpBB nke ọma ma rụọ ọrụ nke ọma n'ọdịnihu, ị kwesịrị ịbawanye nhọrọ ole na ole na faịlụ nhazi php.ini.

Nke mbụ, mepee faịlụ php.ini:

sudo nano /etc/php.ini

Na-esote, ị ga-ahụ ntọala akwadoro iji rụọ ọrụ na phpBB. Ị ga-achọ ịchọta ntọala na ahịrị ma gbanwee ha ka ọ bụrụ ndị a:

max_execution_time = 180 (located on line 338)
max_input_time = 90 (located on line 398)
memory_limit = 256M (located on line 409)
upload_max_filesize = 64M (located on line 846)

Nhọrọ, ụfọdụ ntọala nchekwa abawanyela, enwere ike ịwụpụ nke a:

cgi.fix_pathinfo=0 
session.use_strict_mode = 1
session.use_cookies = 1
session.cookie_secure = 1
session.use_only_cookies = 1
session.name = LCCookies (Change the name, example: POPme)
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain = example.com (example only)
session.cookie_httponly = 1
session.cookie_samesite = Strict

Ozugbo emere, CTRL + O ịzọpụta mgbe ahụ CTRL + X ịpụ na faịlụ.

N'adịghị ka nrụnye LEMP na Debian/Ubuntu na-eji (www-data) onye ọrụ, nke a abụghị ikpe maka nrụnye Rhel/Rocky Linux. Site na ndabara na Rocky Linux, a haziri ọrụ PHP-FPM ka ọ na-agba ọsọ (apache) onye ọrụ, nke ezighi ezi ebe ọ bụ na anyị na-eji Nginx, nke a kwesịrị ka edozi ya.

Nke mbụ, meghere ndị a (www.conf) nhazi faịlụ:

sudo nano /etc/php-fpm.d/www.conf

Na-esote, dochie (apache) onye ọrụ na otu na (Nginx) onye ọrụ na otu:

ka esi etinye nginx, mariadb na PHP na nkume linux 8 nke lemp

Ka ịchekwaa, pịa (CTRL+O) wee pụọ (CTRL+X).

Ị ga-achọ ịmalitegharị PHP ka mgbanwe ndị a na-arụ ọrụ:

sudo systemctl restart php-fpm

Nhazi Nginx

Na ngọngọ nkesa Nginx gị, ịkwesịrị ikwuwapụta PHP elu na ebe PHP.

Ụzọ kachasị mma iji mepụta ngọngọ nkesa ọhụrụ, na-eji subdomain dị ka forums ma ọ bụ obodo.

Ọmụmaatụ nke a dị n'okpuru, gbanwee ka ọ dabara na mkpa gị:

Mbụ, mepụta ngọngọ nkesa:

sudo nano /etc/nginx/conf.d/phpbb.conf

Ugbu a detuo na mado ihe ndị a n'ime ngọngọ nkesa, gbanwee aha ngalaba, SSL, ụzọ mgbọrọgwụ, na ihe ọ bụla ọzọ iji gboo mkpa gị. Agaghị emetụ ebe ndị ahụ na PHP n'onwe ya aka ma ọ bụrụ na ị maara ihe ị na-eme.

Ọmụmaatụ naanị:

server {
   listen 80;
   listen [::]:80;

   server_name forums.example.com;
   root /var/www/html/phpbb;
   index index.php index.html index.htm;

    access_log /var/log/nginx/forums-access.log;
    error_log /var/log/nginx/forums-error.log;

location / {
	try_files $uri $uri/ @rewriteapp;

	# Pass the php scripts to FastCGI server specified in upstream declaration.
	location ~ \.php(/|$) {
		include fastcgi.conf;
                fastcgi_pass unix:/run/php-fpm/www.sock;
		fastcgi_split_path_info ^(.+\.php)(/.*)$;
		fastcgi_param PATH_INFO $fastcgi_path_info;
		fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
		fastcgi_param DOCUMENT_ROOT $realpath_root;
		try_files $uri $uri/ /app.php$is_args$args;
		fastcgi_intercept_errors on;	
	}

	# Deny access to internal phpbb files.
	location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
		deny all;
		# deny was ignored before 0.8.40 for connections over IPv6.
		# Use internal directive to prohibit access on older versions.
		internal;
	}
}

location @rewriteapp {
	rewrite ^(.*)$ /app.php/$1 last;
}

# Correctly pass scripts for installer
location /install/ {
	try_files $uri $uri/ @rewrite_installapp =404;

	# Pass the php scripts to fastcgi server specified in upstream declaration.
	location ~ \.php(/|$) {
		include fastcgi.conf;
                fastcgi_pass unix:/run/php-fpm/www.sock;
		fastcgi_split_path_info ^(.+\.php)(/.*)$;
		fastcgi_param PATH_INFO $fastcgi_path_info;
		fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
		fastcgi_param DOCUMENT_ROOT $realpath_root;
		try_files $uri $uri/ /install/app.php$is_args$args =404;
		fastcgi_intercept_errors on;	
	}
}

location @rewrite_installapp {
	rewrite ^(.*)$ /install/app.php/$1 last;
}

# Deny access to version control system directories.
location ~ /\.svn|/\.git {
	deny all;
	internal;
}

 gzip on; 
 gzip_comp_level 6;
 gzip_min_length 1000;
 gzip_proxied any;
 gzip_disable "msie6";
 gzip_types
     application/atom+xml
     application/geo+json
     application/javascript
     application/x-javascript
     application/json
     application/ld+json
     application/manifest+json
     application/rdf+xml
     application/rss+xml
     application/xhtml+xml
     application/xml
     font/eot
     font/otf
     font/ttf
     image/svg+xml
     text/css
     text/javascript
     text/plain
     text/xml;

  # assets, media
  location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
      expires    90d;
      access_log off;
  }
  
  # svg, fonts
  location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
      add_header Access-Control-Allow-Origin "*";
      expires    90d;
      access_log off;
  }
}

Mara, ahịrị nwere "fastcgi_pass unix:/run/php-fpm/www.sock;" dị mkpa, na-enweghị ya FPM agaghị enwe ike ịkparịta ụka.

Na-esote, ị nwere ike ịme ule ọsọ ọsọ nke ọrụ Nginx gị iji hụ na ihe niile na-arụ ọrụ nke ọma:

sudo nginx -t 

Mmepụta ihe atụ ma ọ bụrụ na ihe niile na-arụ ọrụ nke ọma:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Ugbu a malitegharịa ọrụ Nginx maka phpBB ka ịnweta ya site na UI weebụ:

sudo systemctl restart nginx

Advertisement


Nhọrọ - Chekwaa Nginx na ka anyị zoo SSL Asambodo efu

Dị ka o kwesịrị, ị ga-achọ ịgba ọsọ Nginx gị HTTPS na-eji asambodo SSL. Ụzọ kacha mma isi mee nke a bụ iji Ka anyị zoo, ikike asambodo efu, akpaaka na mepere emepe nke ndị Otu nyocha nchekwa ịntanetị anaghị akwụ ụgwọ (ISRG).

Mbụ, wụnye EPEL ebe nchekwa na mod_ssl ngwugwu maka ngwungwu emelitere nke ọma na nchekwa.

sudo dnf install epel-release mod_ssl -y

Na-esote, wụnye ngwugwu certbot dị ka ndị a:

sudo dnf install python3-certbot-nginx -y

Ozugbo arụnyere, gbanye iwu a ka ịmalite imepụta asambodo gị:

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email you@example.com -d forums.example.com

Nke a bụ ezigbo ntọala nke gụnyere ike HTTPS 301 redirects, Strict-Transport-Security nkụnye eji isi mee, na OCSP Stapling. Naanị jide n'aka na ịhazigharịa e-mail na ngalaba aha na ihe ị chọrọ.

Ugbu a URL gị ga-abụ https://forums.example.com kama HTTP://forums.example.com.

Rịba ama, ọ bụrụ na ị na-eji nke ochie URL HTTP, ọ ga-akpaghị aka redirect gaa na HTTPS.

Nhọrọ, ị nwere ike ịtọ ọrụ cron iji megharịa asambodo na-akpaghị aka. Certbot na-enye edemede nke na-eme nke a na-akpaghị aka, ma ị nwere ike ibu ụzọ nwalee iji jide n'aka na ihe niile na-arụ ọrụ site na ịme ọkụ ọkụ.

sudo certbot renew --dry-run

Ọ bụrụ na ihe niile na-arụ ọrụ, mepee windo crontab gị site na iji iwu njedebe na-esote.

sudo crontab -e

Na-esote, kọwaa oge mgbe ọ ga-emeghari onwe ya. Ekwesịrị ịlele nke a kwa ụbọchị na opekempe, ma ọ bụrụ na achọrọ ka emegharịa asambodo ahụ, edemede ahụ agaghị emelite asambodo ahụ. Ọ bụrụ na ịchọrọ enyemaka na ịchọta ezigbo oge ịtọ, jiri ya crontab.guru ngwá ọrụ efu.

00 00 */1 * * /usr/sbin/certbot-auto renew

Save (CTRL+O) wee pụọ (CTRL+X), na cronjob ga-enyere aka na-akpaghị aka.

Part 2. phpBB Web UI nwụnye

Ọ bụrụ na ihe niile na-arụ ọrụ nke ọma, anyị na-aga ugbu a na-ahọpụtara adreesị nke gị ọhụrụ arụnyere phpBB forums. Dịka ọmụmaatụ anyị, ọ bụ https://forums.linuxcapable.com maka ọmụmaatụ nkuzi, ma ọ bụrụ na ọ ga-aga nke ọma, ị ga-abata na ibe nrụnye bụ isi maka phpBB.

Ozugbo ị rutere na ibe ahụ, pịa bọtịnụ Wụnye n'akụkụ aka ekpe nke dị n'elu iji malite nrụnye eserese.

Ihe Nlereanya:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Na-esote, a ga-akpọrọ gị gaa na ihuenyo ọzọ na-adụ ọdụ maka nkọwa kacha nta na ozi teknụzụ ndị ọzọ. Mgbe ịgụchara na ịlele ugboro abụọ, pịa ya Wụnye bọtịnụ na ala peeji.

Ihe Nlereanya:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Na ihuenyo ọzọ, ịkwesịrị ime mepụta akaụntụ nchịkwa maka phpBB. Gbaa mbọ hụ na ejuju nke a nke ọma yana paswọọdụ siri ike dịka nke a dị mkpa maka mgbake, n'etiti ihe ndị ọzọ.

Ihe Nlereanya:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ugbu a ị banyere nke gị Admin nkọwa nke ọma, ihuenyo nkọwa nchekwa data ga-apụta mejupụta. Mbụ, dobe ndabara MySQL na MySQL Extension ma banye localhost ma ọ bụrụ na nchekwa data gị dị na sava dị iche, tinyezie IP nkesa na ọdụ ụgbọ mmiri ma ọ bụrụ na agbanwere ya na ndabara.

Na-esote na ihe atụ nkuzi, aha nchekwa data ihe atụ phpbb, na phpbbuser ịbụ aha njirimara nke nwere ohere ma e wezụga mgbọrọgwụ iji nweta phpBB nchekwa data. N'ikpeazụ, prefix bụ na ndabara phpbb_, nke ị nwere ike idowe otu ihe ahụ, mana ọ bụrụ na ị ga-etinye ọtụtụ forums, a ga-adụ ọdụ ka ị gbanwee nke a iji dobe prefix ahụ dị ọcha na iche.

Tinye ihe ndị a wee pịa n'okpuru aga n'ihu.

Ihe Nlereanya:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Tọọ nhazi nkesa gị. Ọ bụrụ na ị naghị agba SSL, ntọala ndabara kwesịrị ịbụ nke zuru oke. Ọ bụrụ na ị na-agba SSL, gbanwee ha ka ọ dabara na mkpa gị.

Ihe Nlereanya:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ibe na-esote, ị nwere ike ịtọ SMTP ọ bụrụ na ị nwere nhazi ịbanye. Ọ bụrụ na ọ bụghị, hapụ ndabara wee kụọ ọzọ.

Ihe Nlereanya:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Debe gị Aha Board / Aha na Asụsụ. Ọ bụrụ na ịmaghị ihe ị ga-akpọ forums gị, hapụ ndabara wee kụọ n'okpuru. Ị nwere ike ịgbanwe ntọala ndị a ma emechaa.

Ihe Nlereanya:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Mgbe ịkụchara nrubeisi, ị ga-ahụ ihuenyo ikpeazụ dị ka nke dị n'okpuru ebe etinyere forums yana njikọ na-eduga gị na panel ACP. Ọ bụrụ na ị nwere mperi rụtụ aka azụ dị ka nzọụkwụ, ikike nwere ike agbagharala ya.


Advertisement


Biputere nwụnye phpBB

Wepu ndekọ nwụnye

Daalụ maka ịbanye na akụkụ a. Mgbe ịbanye n'ime panel ACP gị na nke mbụ, ị ga-ahụ nnukwu anya na-acha uhie uhie enyi na-agwa gị ka iwepụ ma ọ bụ nyegharịa akwụkwọ ndekọ aha gị. A na-atụ aro ka ihichapụ, ọ bụghị ịkwaga, ndekọ. Iji mee nke a, jiri iwu a na njedebe gị:

sudo rm -R /var/www/html/phpbb/install

Idozi ikike CHMOD (Nzọụkwụ Dị Mkpa)

Mgbe ị na-arụsi ọrụ ike na-eme iwu ọnụ, Ọ dị oke mkpa ịtọ nke ziri ezi ikikere chmod ka emechara. The Enwere ike ịchọta ntuziaka phpBB gọọmentị na nke a ebe a. Mwụpụ nke a nwere ike hapụ imeghe ụfọdụ ihe egwu nchekwa dị egwu, yabụ biko soro nke a kpọmkwem ma ọ bụ n'ụzọ gị ma ọ bụrụ na ị nwere usoro ka mma mana enweghị. hapụ ikike ndabara!!

sudo find /var/www/html/phpbb -type d -exec chmod 755 {} \;
sudo find /var/www/html/phpbb -type f -exec chmod 644 {} \;

Mgbe nke ahụ gasịrị, anyị kwesịrị ịnye ụfọdụ nchekwa / faịlụ ụfọdụ ikike pụrụ iche naanị dị ka ndị a:

sudo chmod 777 -R /var/www/html/phpbb/files
sudo chmod 777 -R /var/www/html/phpbb/cache
sudo chmod 777 -R /var/www/html/phpbb/store
sudo chmod 777 -R /var/www/html/phpbb/images/avatars/upload

Emeghị nke a ga-emebi ọrụ nke bọọdụ gị. Jide n'aka na ị na-agbaso ụzọ ndị a nke ọma, ma ọ bụ na ị nwere ike ịnye akwụkwọ ndekọ phpBB gị niile n'ụzọ zuru ezu na-agụ ma na-edeghachite ọha na eze, na-ebuteghachi nsogbu nchebe.

Tọọ Cronjob maka phpBB (A kwadoro)

Nzọụkwụ ikpeazụ ikpeazụ na ntuziaka anyị bụ ịtọlite ​​​​cronjob. A na-atụ aro Cronjobs na nnọkọ ndị na-arụsi ọrụ ike na ngwa ngwa iji guzobe ọrụ cron iji na-agba ọsọ nkeji 5 ọ bụla site na ụkpụrụ phpBB.

Weta crontab:

sudo crontab -e

Nhọrọ cronjob mbụ:

*/5 * * * * /usr/bin/php /var/www/html/phpbb/bin/phpbbcli.php cron:run > /dev/null 2>&1

Ihe Nlereanya:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Iji chekwaa, CTRL + O wee pụọ na CTRL + X. Ọ bụrụ na ọ ziri ezi, ị ga-ahụ nsonaazụ na-esote azụ na ọdụ gị:

crontab: installing new crontab

Nke a pụtara na etinyere ya ma na-arụ ọrụ, a na-adụ ọdụ ka ị na-agba ọsọ cronjobs kwa nkeji 5 na phpBB; Otú ọ dị, ị nwere ike ịhazigharị oge iji kwado mkpa gị ma ọ bụrụ na ịchọrọ.

Ugbu a, kpagharịa ogwe nchịkwa gị azụ na phpBB wee mee ka ọrụ cron nkesa dị na ntọala nkesa gị.

Ihe Nlereanya:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Ekele, ị rụnyela ọgbakọ phpBB nke ọma, ma ị dịla njikere chepụta ọgbakọ gị wee malite obodo gị. A na-atụ aro ka ị lelee webụsaịtị gọọmentị na wiki nke phpBB n'ihi na o nwere ọtụtụ ozi gbasara nhazi nke ọgbakọ gị, nke ga-abụ nke ukwuu itinye na ntuziaka a anyị mepụtara ebe a.


atụ:

Otu esi etinye phpBB na LEMP (Nginx, MariaDB, na PHP) na Rocky Linux 8

Okwu na mmechi

Banyere nchekwa, ndị otu phpBB na-egosi enweghị CVE's ruo ọtụtụ afọ na, mgbe ha na-enyocha mmebi iwu nwere ike, chọpụtara na ndị ọrụ anaghị elekwasị anya. "nwere nchebe" installs, dị ka ụfọdụ nzọụkwụ anyị rụtụrụ aka na ntuziaka dị ka chmod ikike. phpBB bụ sọftụwia mepere emepe nke na-apụtaghị na ọ ga-apụ n'anya n'oge adịghị anya. Enwetụbeghị m nsogbu na ihe nkesa siri ike, nke siri ike, ntọala phpBB mbụ.

Obodo 3rd dị ezigbo mma. Ole na ole n'ime ndị a ile anya bụ SplickerSnap na DMZX, ma enwere m ike depụta 20 ma ọ bụ karịa kwesịrị ka a kpọtụrụ ya aha.

Idenye aha
Gwa nke
0 Comments
Inline nzaghachi
Lee echiche niile
0
Ga-ahụ n'anya gị echiche, biko okwu.x