Otu esi etinye WordPress na LEMP (Nginx, MariaDB, na PHP) na Debian 11 Bullseye

WordPress bụ usoro njikwa ọdịnaya kachasị nke edere na PHP, jikọtara ya na MySQL ma ọ bụ nchekwa data MariaDB. Ị nwere ike ịmepụta ma jikwaa saịtị na-enweghị ihe ọmụma ọ bụla na mmepe weebụ ma ọ bụ nzuzo. Emepụtara ụdị WordPress mbụ na 2003 site n'aka Matt Mullenweg na Mike Little ma ugbu a 70% nke ahịa webụ ama ama, dịka W3Tech si kwuo. WordPress na-abịa na nsụgharị abụọ: isi mmalite mepere emepe n'efu WordPress.org na WordPress.com, ọrụ akwụ ụgwọ na-amalite na $5 kwa ọnwa ruo $59. Iji usoro njikwa ọdịnaya a dị mfe ma na-ahụkarị dị ka ihe mgbago maka ịme blọgụ ma ọ bụ saịtị yiri ya.

N'ime nkuzi na-esote, ị ga-amụta ka esi etinye WordPress nke na-akwado onwe ya site na iji ụdị Nginx, MariaDB na PHP ọhụrụ dị.

Prerequisites

  • OS akwadoro: Nnenna 11 Bullseye
  • Akaụntụ onye ọrụ: Akaụntụ onye ọrụ nwere sudo ma ọ bụ ohere mgbọrọgwụ.
  • Ngwungwu achọrọ: edepụtara n'oge nkuzi

Melite Sistemụ Ọrụ

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

sudo apt update && sudo apt upgrade -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@debian~]$ sudo whoami
root

Ka ịtọlite ​​akaụntụ sudo dị adị ma ọ bụ ọhụrụ, gaa na nkuzi anyị na Ịgbakwunye onye ọrụ na Sudoers na Debian.

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

su

Wụnye ngwugwu CURL & UNZIP

Nkuzi na-eji ihe curl na unzip iwu n'oge ụfọdụ akụkụ. Iji jide n'aka na etinyere nke a, gbanye iwu a na ọdụ gị:

sudo apt install curl unzip -y

Advertisement


Wụnye Nginx Kacha ọhụrụ – (LEMP Stack)

Iji malite nrụnye nchịkọta LEMP, ị ga-achọ ịwụnye ya Nginx sava weebụ. Usoro bụ ịwụnye Nginx mainline ma ọ bụ kwụsie ike site na ebe nchekwa Ondřej Surý iji nweta ngwanrọ emelitere kacha ọhụrụ. Ọtụtụ ndị ọrụ Ubuntu ga-ama PPA ya, ị nwekwara ike ime otu ihe ahụ nke ukwuu na Debian.

Iji jiri ụdị Nginx kacha ọhụrụ ma ọ bụ kwụsie ike, ị ga-ebu ụzọ bubata ebe nchekwa ahụ.

Iji bubata ebe nchekwa mainline:

curl -sSL https://packages.sury.org/nginx-mainline/README.txt | sudo bash -x

Ka ibubata ebe nchekwa kwụsiri ike:

curl -sSL https://packages.sury.org/nginx/README.txt | sudo bash -x

Melite ebe nchekwa gị iji gosipụta mgbanwe ọhụrụ:

sudo apt update

Ugbu a ị wụnyela Nginx ebe nchekwa wee melite ndepụta nchekwa, tinye Nginx na ihe ndị a:

sudo apt install nginx-core nginx-common nginx nginx-full

Ihe atụ mmepụta:

Otu esi etinye WordPress na LEMP (Nginx, MariaDB, na PHP) na Debian 11 Bullseye

Pịnye "Y,” wee pịa ya "Tinye igodo" ịga n'ihu na mezue nrụnye.

Ugbu a lelee iji hụ na etinyere Nginx kachasị ọhụrụ sitere na ebe nchekwa Ondřej Surý site na iji iwu amụma apt-cache. Mara, na nkuzi ihe atụ arụnyere Nginx Mainline:

apt-cache policy nginx

Ihe atụ maka Nginx Mainline:

Otu esi etinye WordPress na LEMP (Nginx, MariaDB, na PHP) na Debian 11 Bullseye

Rịba ama na enwere ike ịkpali gị idowe ma ọ bụ dochie gị dị / wdg / nginx /nginx.conf nhazi faịlụ n'oge echichi. A na-atụ aro ka idobe faịlụ nhazi gị ugbu a site na ịpị (n). A ga-eme otu n'agbanyeghị ụdị onye na-elekọta ya, ma ị nwekwara ike ịlele nke a n'ọdịnihu.

Ị ga-achọpụta na modul ndị ọzọ ga-adị na ụdị a, karịsịa nkwado brotli. Iji wụnye brotli, soro usoro ndị a n'okpuru.

mepee gị nginx.conf nhazi faịlụ:

nano /etc/nginx/nginx.conf

Ugbu a tinye ahịrị ndị ọzọ tupu na nke HTTP{} ngalaba:

brotli on;
brotli_comp_level 6;
brotli_static on;
brotli_types application/atom+xml application/javascript application/json application/rss+xml
   application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype
   application/x-font-ttf application/x-javascript application/xhtml+xml application/xml
   font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon
   image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml;

The brotli_comp_level enwere ike ịtọ n'etiti 1 (kasị ala) na 11 (kachasị elu). Dịka, ọtụtụ sava na-anọdụ n'etiti, mana ọ bụrụ na ihe nkesa gị bụ nnukwu anụ, tọọ 11 wee lelee ọkwa ojiji CPU.

Na-esote, nwalee ka ijide n'aka na mgbanwe ndị a na-arụ ọrụ nke ọma tupu ime ka ọ dị ndụ:

sudo nginx -t

Ọ bụrụ na mgbanwe ndị a na-arụ ọrụ nke ọma, ị ga-ahụ ihe ndị a:

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

Ugbu a mee mgbanwe ndị a dị ndụ site na ịmalitegharị ihe nkesa gị:

sudo systemctl restart nginx

Ọzọ, mee ka Nginx rụọ ọrụ na buut sistemụ:

sudo systemctl enable nginx

N'ikpeazụ, nyochaa Nginx na-agba ọsọ nke ọma; nke a kwesịrị ịdị mma ịwụpụ ma ọ bụrụ na ị gbara ọsọ nginx -t iwu ma nwetaghị mperi.

systemctl status nginx

Ihe atụ mmepụta:

Otu esi etinye WordPress na LEMP (Nginx, MariaDB, na PHP) na Debian 11 Bullseye

Wụnye MariaDB (LEMP STACK)

Ka phpBB wee na-agba ọsọ, ị ga-achọ ịwụnye ngwanrọ nchekwa data; nyere anyị na-eji LEMP, nhọrọ ga-abụ MariaDB.

Ị nwere ike iwunye ụdị ndabara nke MariaDB site na ebe nchekwa Debian, nkuzi ahụ ga-etinyekwa ya kacha ọhụrụ 10.6 MariaDB.

Wụnye Dependencies

Nzọụkwụ mbụ bụ ịwụnye ihe ndabere achọrọ maka nrụnye. Iji mee nke a, jiri iwu a na njedebe gị:

Bubata igodo GPG na ebe nchekwa

Iji wụnye MariaDB nke ọma, ị ga-ebubata igodo GPG iji chọpụta na ngwugwu ndị ahụ sitere na isi mmalite na agbanweghị ya. Iji mee nke a, jiri iwu a:

sudo curl -LsSO https://mariadb.org/mariadb_release_signing_key.asc
sudo chmod -c 644 mariadb_release_signing_key.asc
sudo mv -vi mariadb_release_signing_key.asc /etc/apt/trusted.gpg.d/
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://mirror.realcompute.io/mariadb/repo/10.6/debian bullseye main'

Rịba ama, enwere ike ịchọta enyo nbudata na peeji a si MariaDB ntọala ka ịchọta ebe dị gị nso maka ebe nchekwa.

Ugbu a ebubatara igodo na ebe nchekwa, melite ndepụta njikwa ngwugwu dabara adaba iji gosipụta mgbakwunye ọhụrụ ahụ.

sudo apt update

Tinye MariaDB

Iji wụnye MariaDB, ị ga-achọ ịwụnye onye ahịa na ngwugwu ihe nkesa. Enwere ike ime nke a dị ka ndị a:

sudo apt install mariadb-server mariadb-client

Ihe atụ mmepụta:

Otu esi etinye WordPress na LEMP (Nginx, MariaDB, na PHP) na Debian 11 Bullseye

Ụdị "Y,” wee pịa ya "Tinye igodo" ịga n'ihu na mezue nrụnye.

Kwado nrụnye nke MariaDB site na ịlele ụdị ma wuo:

mariadb --version

Ihe atụ mmepụta:

mariadb  Ver 15.1 Distrib 10.6.4-MariaDB, for debian-linux-gnu (x86_64) using readline EditLine wrapper

Na-esote, malite ọrụ MariaDB gị site n'ịgbaso iwu na-esonụ iji malite ma gbanye na buut:

sudo systemctl start mariadb && sudo systemctl enable mariadb

Mwepụta ihe atụ ma ọ bụrụ na ọ ga nke ọma:

Synchronizing state of mariadb.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mariadb

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 start mariadb

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

Otu esi etinye WordPress na LEMP (Nginx, MariaDB, na PHP) na Debian 11 Bullseye

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

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

sudo mysql_secure_installation

Ọ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 WordPress na LEMP (Nginx, MariaDB, na PHP) na Debian 11 Bullseye

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 (LEMP STACK)

A na-emepụta ihe ndị bụ isi nke WordPress ma na-eji PHP. PHP 7.4 bụ ụdị kwụsiri ike ugbu a yana 8.0 n'oge na-adịghị anya iji PHP 8.1 Beta dochie ya. Okwu a bụ WordPress na-akwado PHP 8.0, yabụ ị kwesịrị ịwụnye ụdị a maka ịrụ ọrụ + ndozi nchekwa, mana ụfọdụ isiokwu na plugins ka adabaghị ma ọ bụ nwee ahụhụ, mee nyocha gị tupu ịzụrụ plugins / gburugburu ọhụrụ ọ bụla iji jide n'aka na ha na-akwado. PHP 8.0.

Na iji wụnye ụdị PHP kwụsiri ike na Debian, ị ga-etinye ebe nchekwa Ondřej Surý PHP, onye na-echekwa PHP, na Debian. N'ime ebe nchekwa a, ụdị PHP 7.4 na 8.0 kachasị ọhụrụ dị n'oge niile, gụnyere mgbakwunye. Nkuzi a ga-edepụta ụzọ ọzọ isi tinye ha abụọ, ma ị ga-enyocha nke kacha mma.

Bubata & Wụnye igodo GPG:

Nzọụkwụ mbụ bụ mbubata na wụnye ihe igodo GPG tupu ịtinye ebe nchekwa. Iji mee nke a, jiri iwu njedebe a:

wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

Mara, ị nwere ike ịwụnye ndabere ndị a ma ọ bụrụ na ị nwere nsogbu:

sudo apt install apt-transport-https lsb-release ca-certificates

Bubata & Wụnye ebe nchekwa:

Iji hazie igodo GPG, oge eruola ịgbakwunye ya Ondřej Surý repository dị ka ndị a:

sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'

Na-esote, melite ndepụta ebe nchekwa dị ka ebe nchekwa ọhụrụ ga-achọ ka nkwalite ụfọdụ ngwugwu dị adị ma gwa ya ka ime tupu ịwụnye ụdị PHP ọ bụla.

sudo apt update && sudo apt upgrade

Nhọrọ 1. Wụnye PHP 7.4

Ugbu a ị nwere ike ịga n'ihu ịwụnye PHP 7.4 maka mkpa gị dị ka ndị a:

sudo apt install php7.4-fpm php7.4-cli php7.4-common php7.4-mbstring php7.4-xmlrpc php7.4-soap php7.4-gd php7.4-xml php7.4-intl php7.4-mysql php7.4-cli php7.4-ldap php7.4-zip php7.4-mcrypt php7.4-curl php7.4-json php7.4-opcache php7.4-readline php7.4-xml php7.4-gd -y

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

php -v

Ihe atụ mmepụta:

Otu esi etinye WordPress na LEMP (Nginx, MariaDB, na PHP) na Debian 11 Bullseye

Na-esote, malite ma mee ka PHP 7.4-FPM malite na-akpaghị aka na buut.

sudo systemctl start php7.4-fpm && sudo systemctl enable php7.4-fpm

Ugbu a, site na ndabara, PHP-FPM kwesịrị ịdị na-agba ọsọ. Iji kwado nke a, jiri iwu systemctl a:

sudo systemctl status php7.4fpm

Ihe atụ mmepụta:

Otu esi etinye WordPress na LEMP (Nginx, MariaDB, na PHP) na Debian 11 Bullseye

Nhọrọ 2. Wụnye PHP 8.0

Ugbu a ị nwere ike ịga n'ihu ịwụnye PHP 8.0 maka mkpa gị dị ka ndị a:

sudo apt install php8.0-fpm php8.0-cli php8.0-common php8.0-mbstring php8.0-xmlrpc php8.0-soap php8.0-gd php8.0-xml php8.0-intl php8.0-mysql php8.0-cli php8.0-ldap php8.0-zip php8.0-mcrypt php8.0-curl php8.0-opcache php8.0-readline php8.0-xml php8.0-gd unzip -y

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

php -v

Ihe atụ mmepụta:

Otu esi etinye WordPress na LEMP (Nginx, MariaDB, na PHP) na Debian 11 Bullseye

Ugbu a, site na ndabara, PHP-FPM kwesịrị ịdị na-agba ọsọ. Iji kwado nke a, jiri iwu systemctl a:

sudo systemctl status php8.0-fpm

Ihe atụ mmepụta:

Otu esi etinye WordPress na LEMP (Nginx, MariaDB, na PHP) na Debian 11 Bullseye

Part 1. Wụnye WordPress Backend

Download WordPress

Gaa na WordPress.org download page wee gbadaa ruo mgbe ịchọtara "kacha ọhụrụ.zip” download njikọ. Ọ bụrụ na ị na-ebugharị na desktọpụ, ị nwere ike iji aka budata nke a ma ọ bụ jiri iwu wget budata ọdụ desktọpụ gị CTRL + ALT + T.

wget https://wordpress.org/latest.zip

Mepụta Nhazi nchekwa maka WordPress

Ugbu a ị budatala ebe nchekwa ahụ, gaba n'ihu ịtọpụ ya ma bugharịa ya na nke gị www ndekọ.

Mepụta ndekọ aha maka WordPress:

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

Wepu WordPress na ndekọ www:

sudo unzip latest.zip -d /var/www/html/

Ị ga-edozi ikike onye nwe ndekọ aha na WWW, ma ọ bụ ọzọ ị ga-enwe nsogbu na WordPress ide ikike.

Tọọ ikike chown (dị mkpa):

sudo chown -R www-data:www-data /var/www/html/wordpress/

Tọọ ikike chmod (dị mkpa):

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

Mepụta database maka WordPress

WordPress chọrọ nchekwa data ka ọ rụọ ọrụ ya mere ị ga-eji tinye MariaDB. Tupu ịga n'ihu, ịkwesịrị ịmepụta nchekwa data maka WordPress site na iji MariaDB. Nke mbụ, bulite console terminal wee pịnye ihe ndị a.

Weta shei MariaDB dị ka mgbọrọgwụ:

sudo mariadb -u root

Iwu ọzọ nke abụọ:

sudo mysql -u root

Ọzọ, mepụta nchekwa data. Nke a nwere ike ịbụ aha ọ bụla ịchọrọ. Maka ntuziaka, ị ga-akpọ ya "WORDPRESSDB."

Mepụta nchekwa data WordPress:

CREATE DATABASE WORDPRESSDB;

Mgbe emechara nchekwa data, ịkwesịrị ịmepụta onye ọrụ ọhụrụ maka saịtị ọhụrụ WordPress.

A na-eme nke a dị ka ihe nchebe, ya mere ọ bụla nchekwa data nwere onye ọrụ dị iche iche. Ọ bụrụ na otu aha njirimara emebiela, onye mwakpo ahụ anaghị abanye na ọdụ data weebụsaịtị ndị ọzọ.

Mepụta onye ọrụ nchekwa data WordPress:

CREATE USER 'WPUSER'@localhost IDENTIFIED BY 'PASSWORD';

Dochie WPUSER na PASSWORD na aha njirimara ma ọ bụ paswọọdụ ị chọrọ. Edetula ma mado onye ọrụ/ ngafe ndabara n'elu maka ebumnuche nchekwa.

Ugbu a kenye onye ọrụ emepụtara ọhụrụ ohere ịnweta nchekwa data webụsaịtị WordPress naanị dị ka ọ dị n'okpuru.

Kenye nchekwa data na akaụntụ onye ọrụ WordPress emepụtara:

GRANT ALL PRIVILEGES ON WORDPRESSDB.* TO WPUSER@localhost IDENTIFIED BY 'PASSWORD';

Na ntọala nhazi nchekwa data niile zuru oke, ịkwesịrị ikpochapụ ohere ndị ahụ iji mee ihe wee pụọ.

Ghichaa ihe ùgwù ime ndụ:

FLUSH PRIVILEGES;

Wepụ MariaDB:

EXIT;

Advertisement


Tọọ faịlụ nhazi WordPress

Ịkwesịrị ịtọ ntọala ụfọdụ na "WP-config-sample.php" faịlụ. N'okpuru ebe a, ị ga-ahụ ka ị ga-esi nyegharịa faịlụ nlele aha wee tinye ozi achọrọ.

Mbụ, nyegharịa faịlụ nhazi aha.

Gaa na ndekọ ndekọ WordPress:

cd /var/www/html/wordpress/

Nyegharịa faịlụ nhazi aha:

sudo mv wp-config-sample.php wp-config.php

Ugbu a, na-eji editọ ederede, weta faịlụ wp-config.php akpọgharịrị ọhụrụ. N'ihe atụ anyị, anyị ga-eji nano.

sudo nano wp-config.php

Ọzọ, ị ga-abanye aha nchekwa data, akaụntụ onye ọrụ na paswọọdụ, adreesị IP nnabata ma ọ bụrụ na ọ dị iche na localhost.

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */ 
define( 'DB_NAME', 'wordpressdb' );
/* MySQL database username */ 
define( 'DB_USER', 'wpuser1' );
/* MySQL database password */
define( 'DB_PASSWORD', 'YOUR PASSWORD' );
/* MySQL hostname, change the IP here if external DB set up */ 
define( 'DB_HOST', 'localhost' );
/* Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/* The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

Mgbe ị nọ na faịlụ a, ịgbakwunye ntọala ndị ọzọ ga-eme ka WordPress gị dịkwuo mfe ijikwa, dị ka ịchekwa faịlụ ozugbo kama iji FTP na ụbara oke oke ebe nchekwa.

##Save files direct method##
 define( 'FS_METHOD', 'direct' );

##Increase memory limit, 256MB is recommended##
 define('WP_MEMORY_LIMIT', '256M');

##change Wordpress database table prefix if wanted##
 $table_prefix = 'wp_';

##set cache enabled, this if you intend to use Wordpress add-ons##
 define('WP_CACHE', true);

Tọọ igodo nnu nchekwa WordPress

Ọ ga-akacha mma ma ọ bụrụ na ị gaa na WordPress nzuzo API API iji mepụta nke gị. Enwere ike ịchọta generator nnu igodo na https://api.wordpress.org/secret-key/1.1/salt/. Dochie ahịrị ihe atụ na koodu sitere na generator.

Edepụtaghachila Ọmụmaatụ N'okpuru, Ọ BỤ naanị maka ntụaka.

define('AUTH_KEY',         '<3yfS7/>%m.Tl^8Wx-Y8-|T77WRK[p>(PtH6V]Dl69^<8|K86[_Z},+THZ25+nJG');
define('SECURE_AUTH_KEY',  'bN#Qy#ChBX#Y`PE/_0N42zxgLD|5XpU[mu.n&:t4q~hg<UP/b8+xFTly_b}f]M;!');
define('LOGGED_IN_KEY',    'owpvIO-+WLG|,1)CQl*%gP1uDp}s(jUbYQ[Wm){O(x@sJ#T}tOTP&UOfk|wYsj5$');
define('NONCE_KEY',        '8=Vh|V{D<>`CLoP0$H!Z3gEqf@])){L+6eGi`GAjV(Mu0YULL@sagx&cgb.QVCbi');
define('AUTH_SALT',        '%TX*X$GE-;|?<-^(+K1Un!_Y<hk-Ne2;&{c[-v!{q4&OiJjQon /SHcc/:MB}y#(');
define('SECURE_AUTH_SALT', '=zkDT_%}J4ivjjN+F}:A+s6e64[^uQ<qNO]TfHS>G0elz2B~7Nk.vRcL00cJoo7*');
define('LOGGED_IN_SALT',   '{$-o_ull4|qQ?f=8vP>Vvq8~v>g(2w12`h65ztPM(xo!Fr()5xrqy^k[E~TwI!xn');
define('NONCE_SALT',       'a1G(Q|X`eX$p%6>K:Cba!]/5MAqX+L<A4yU_&CI)*w+#ZB+*yK*u-|]X_9V;:++6');

Nhazi ngọngọ sava Nginx

Ugbu a, ị dịla njikere ịwụnye WordPress site na UI webụ. Agbanyeghị, ịkwesịrị ịhazi ngọngọ nkesa Nginx gị. Ntọala ndị dị n'okpuru dị ezigbo mkpa. Ọ ga-kwuru ka mesie mkpa nke "try_files $uri $uri/ /index.php?$args;" dị ka ọ na-abụkarị ihe esemokwu na nkuzi ndị ọzọ na-ahapụ njedebe ?$args hapụrụ, na-enye gị isi okwu ahụike saịtị na-abịa na REST API nke WordPress.

Nke mbụ, mepụta faịlụ nhazi ihe nkesa ọhụrụ site na iji iwu a dochie ihe atụ na aha ngalaba gị,

sudo nano /etc/nginx/sites-available/example.com.conf

N'okpuru bụ ihe atụ; ị nwere ike họrọ akụkụ; Otú ọ dị, na "ebe ~ \.php$" kwesịrị ịdị na faịlụ nhazi Nginx.

IHE: Jide n'aka na ịgbanwe www.example.com na example.com na mgbọrọgwụ ụzọ.

server {

  listen 80;
  listen [::]:80;
  server_name www.example.com example.com;

  root /var/www/html/wordpress;

  index index.php index.html index.htm index.nginx-debian.html;


  location / {
  try_files $uri $uri/ /index.php?$args;
 }

  location ~* /wp-sitemap.*\.xml {
    try_files $uri $uri/ /index.php$is_args$args;
  }

  client_max_body_size 100M;

  location ~ \.php$ {
    fastcgi_pass unix:/run/php/php7.4-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    include snippets/fastcgi-php.conf;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 4 128k;
    fastcgi_intercept_errors on;	
  }

 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;
  }

  location ~ /\.ht {
      access_log off;
      log_not_found off;
      deny all;
  }
}

Mara, ọ bụrụ na ị na-eji PHP 8.0 chọta ma dochie ahịrị dị n'elu "fastcgi_pass unix:/run/php/php7.4-fpm.sock;" na "fastcgi_pass unix:/run/php/php8.0-fpm.sock;".

Na-esote, ị ga-achọ ime ka Nginx nhazi faịlụ site na "saịtị-dị". Iji mee nke a, ị ga-emepụta symlink ka "Saịtị kwadoro" dị ka ndị a.

sudo ln -s /etc/nginx/sites-available/example.conf /etc/nginx/sites-enabled/

Dị njikere iji dochie " example.conf" na aha faịlụ nhazi gị.

Ugbu a ị nwere ike ịme ọsọ akọrọ wee malitegharịa ihe nkesa Nginx gị ma ọ bụrụ na ihe niile dị mma.

sudo nginx -t

Mgbe ịlele na ihe niile dị mma na Nginx dry run test gị, malitegharịa ọrụ Nginx.

sudo systemctl restart nginx

Nhazi PHP.ini

Tupu ịkwaga na akụkụ nrụnye UI webụ, ị kwesịrị ịhazi PHP gị maka ojiji kacha mma maka WordPress. Ntọala ndị a bụ ntụzịaka karịa. Ị nwere ike ịba ụba, belata ka ọ dị gị mma.

Mbụ, weta php.ini gị. Rịba ama na ọnọdụ gị nwere ike ịdị iche dabere na nọmba ụdị PHP ị nwere.

PHP 7.4:

sudo nano /etc/php/7.4/fpm/php.ini

PHP 8.0:

sudo nano /etc/php/8.0/fpm/php.ini

Ugbu a, faịlụ mgbasa ozi WordPress nwere ike ịdị oke mkpa. Ihe ndabara nwere ike ịdị oke ala. Ị nwere ike ịbawanye nke a ka ọ bụrụ ihe ị chere na oke faịlụ gị ga-abụ. Chọta ahịrị ndị a n'okpuru wee gbanwee ka mkpa gị dị.

##increase upload max size recommend 50 to 100mb## 
 upload_max_filesize = 100MB

##increase post max size recommend 50 to 100mb##
 post_max_size = 100MB

## increase max execution time recommend 150 to 300##
 max_execution_time = 300

## increase GET/POST/COOKIE input variables recommend 5000 to 10000##
max_input_vars = 10000

## increase memory limit recommend 256mb or 512mb##
memory_limit = 512M

Ugbu a malitegharịa sava PHP-FPM gị.

PHP 7.4:

sudo systemctl restart php7.4-fpm

PHP 8.0:

sudo systemctl restart php8.0-fpm

Ntọala PHP nke ị meziri bụ maka azụ azụ PHP. Ị ga-achọkwa ịgbanwe ngọngọ ihe nkesa Nginx iji nye ohere maka nnukwu anụ ahụ. Emere nke a site na imeghe ngọngọ nkesa gị na ịgbakwunye ahịrị ndị a.

Mepee ngọngọ sava gị:

sudo nano /etc/nginx/sites-available/example.com

Hazie ahịrị a ka iwelie nha ahụ:

client_max_body_size 100M;

Cheta, debe max nke onye ahịa ka nke gị max size ntọala faịlụ PHP.

Na-esote, nwalee mgbanwe ndị ahụ, malitegharịa ihe nkesa Nginx gị ma ọ bụrụ na ihe niile dị mma.

sudo nginx -t

Mgbe ịlele na ihe niile dị mma na Nginx dry run test gị, malitegharịa ọrụ Nginx.

sudo systemctl restart nginx

Part 2. Wụnye WordPress Frontend

Ugbu a na ntọala ndabere na nhazi niile zuru oke, ị nwere ike ịga na ngalaba gị wee malite ịwụnye.

##go to installation address##
 https://www.yoursite.com
##alternative url##
 https://www.yoursite.com/wp-admin/install.php

Ibe mbụ ị ga-ahụ bụ ịmepụta aha njirimara na paswọọdụ yana ụfọdụ nkọwa saịtị. Nke a ga-abụ akaụntụ nbanye admin gị n'ọdịnihu. Ị nwekwara ike ịgbanwe nke a ma emechaa.

Otu esi etinye WordPress na LEMP (Nginx, MariaDB, na PHP) na Debian 11 Bullseye

Ọ bụrụ na ị na-ewu weebụsaịtị, na-enyere "na-akụda ngwa nchọta ike ka ha ghara itinye aha" na-egbochi Google ma ọ bụ Bing ma ọ bụ ihe ọ bụla ọzọ "Ezigbo search engine bot" site na ntinye aha webụsaịtị WIP. Ozugbo emechara, ị ga-eji nbanye bịa na ihuenyo ọzọ.

Otu esi etinye WordPress na LEMP (Nginx, MariaDB, na PHP) na Debian 11 Bullseye

Ekele, ị tinyela ụdị WordPress ọhụrụ nke ọma na Nginx site na iji nchịkọta LEMP.


Advertisement


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 ngwugwu certbot dị ka ndị a:

sudo apt 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 www.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://www.example.com kama HTTP://www.example.com.

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

Okwu na mmechi

WordPress na-enye ikike dị egwu ịmepụta weebụsaịtị ngwa ngwa nwere ndebiri na plugins. Ụlọ ahịa ngwa mgbakwunye na-akwado oke nhọrọ. Agbanyeghị, iji meghee ikike nke ọtụtụ isiokwu na mgbakwunye, ha niile bụ ụgwọ akwụ ụgwọ, mana ọtụtụ dị ọnụ ala.

WordPress nnabata nke onwe bụ ihe na-atọ ụtọ. Agbanyeghị, ijide n'aka na ị na-echekwa nchekwa na imelite dị mkpa. WordPress bụ CMS kachasị lekwasịrị anya n'ụwa site n'aka ndị na-awakpo, na saịtị gị, n'ụbọchị mbụ ya na-enweghị edepụta aha ga-enyocha ya maka nrigbu, na mbọ ike ga-amalite.

Idenye aha
Gwa nke
18 Comments
Inline nzaghachi
Lee echiche niile

amabeghị ebe achọrọ faịlụ ahụ, yana aha ya. {/etc/nginx/sites-available/example.com.conf}
iwu anaghị arụ ọrụ
- sudo systemctl ln -s /etc/nginx/sites-available/example.conf /etc/nginx/sites-enabled/

ma otu a ka e mere
mgbe ị na-abanye iwu
sudo systemctl ln -s /etc/nginx/sites-available/example.conf /etc/nginx/sites-enabled/
ma ọ na-enye njehie
Ekpughị ikewapụta eriri mgbaama /etc/nginx/sites-available/test.conf.

daalụ maka akụkọ ahụ, ị ​​nwere nkọwa kachasị mma!

ọrụ 😁🎉Daalụ!!!

njehie na-eme mgbe ị na-abanye paswọọdụ (Nnọọ na usoro ntinye WordPress a ma ama nke nkeji ise!)Biko nye aha njirimara bara uru. Achọtara m ihe ngwọta, ma ọ siri nnọọ ike. Ma eleghị anya, e nwere ihe ngwọta ọzọ.
https://www.thetechtrackers.com/2019/06/table-prefix-must-not-be-empty.html

Agbalịrị m ya ugbu a. ọnọdụ ahụ agbanwebeghị

tinyegharịa ya ọtụtụ ugboro. gụnyere Debian. Jiri nlezianya wụnye WordPress na LAMP. Naanị ihe dị iche m chọpụtara bụ Ver 15.1 Distribub 10.5.12-MariaDB (a napụtara ya na-akpaghị aka).

Debian 11/Nginx/MariaDB/PHP 8.0

mgbe ahụ, anyị ga-etinye ngwugwu a linuxcapable.com/how-to-install-wordpress-on-ubuntu-20-04-nginx-mariadb-php7-4/. Daalụ maka gị!!! Ezigbo ọrụ. Ana m eme ihe na-ezighi ezi ebe 😔

Daalụ maka okwu nkwado !!! Ọ tụgharịrị wụnye🎉🎉🎉I wụnyeghị Chekwaa MariaDB na script nchekwa/Nginx echekwara ya na ka anyị zoo SSL Asambodo efu.I dochie echichi - Bubata igodo GPG na ebe nchekwa
sudo apt-nweta wụnye software-properties-common dirmngr apt-transport-https
sudo apt-key adv –fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo add-apt-repository 'deb [arch=amd64,i386,arm64,ppc64el] https://ftp.ubuntu-tw.org/mirror/mariadb/repo/10.6/debian sid main'

ma eleghị anya ọ ga-enyere mmadụ aka - Edere ihe niile n'ụzọ zuru ezu. Daalụ onye edemede maka ọrụ a rụrụ!

18
0
Ga-ahụ n'anya gị echiche, biko okwu.x