Yuav ua li cas rau nruab WordPress ntawm Ubuntu 18.04 thiab derivatives?

Ubuntu 18.04 WordPress

WordPress tau dhau los ua ib qho ntawm cov ntsiab lus tswj lub (CMS) nrov tshaj plaws thiab siv nyob hauv cov network, Qhov no vim tias nws tuaj yeem hloov mus rau ntau hom kev siv, nws tseem muaj ntau ntawm cov plug-ins uas tso cai rau koj ntxiv txhim kho nws qhov kev siv thiab tsis tas tawm cov ntsiab lus lossis tawv nqaij ntawm lub pas dej no.

Zaum no peb tab tom yuav qhia txoj kev qhia yooj yim yuav ua li cas rau nruab WordPress hauv Ubuntu, qhov no thiaj li muaj qhov chaw sim lossis rau cov neeg uas tseem tsis paub nws txoj haujlwm.

Txheej txheem kev teeb tsa

Ua ntej ua ib yam dabtsi, koj yuav tsum hloov qhov system nrog:

sudo apt-get upgrade && sudo apt-get upgrade -y

Nginx installation

Txhawm rau nruab WordPress rau hauv peb qhov system, peb tab tom yuav cia siab rau ob peb lub cuab yeej rau nws ua haujlwm, thawj tus yog Nginx:

sudo apt-get install nginx -y

MariaDB kev teeb tsa

Rau qhov kev pabcuam khaws ntaub ntawv peb tabtom xaiv MariaDB, rau nws cov installation peb ua:

sudo apt-get install mariadb-server -y

Ua li cas tam sim no peb yuav kom txim tuag rau nram qab no hais kom ua lub hauv paus rau lub database:

mysql_secure_installation

Ntawm no tsuas yog peb yuav ua raws li cov lus qhia thiab nws yuav hais kom peb teeb tus password, uas peb yuav tsum tsis txhob hnov ​​qab.

tsim cov ntaub ntawv

Peb yuav tsum nkag mus nrog cov ntawv pov thawj uas peb tso rau hauvYog tias peb tawm ntawm lub neej ntawd, nws yuav tsum yog li hauv qab no:

mysql -u root -p

Yog tias lawv yuav tsum tsis txhob tso koj lub npe tom qab -u thiab koj tus password tom qab -p

Ua li no nws txog sijhawm los tsim cov ntaub ntawv, nrog WordPress qhov twg yuav tau txais kev pabcuam los ntawm kev tswj cov haujlwm no:

CREATE DATABASE wordpress;

CREATE USER `tu-usuario`@`localhost` IDENTIFIED BY 'tucontraseña';

GRANT ALL ON wordpress.* TO `wpuser`@`localhost`;

FLUSH PRIVILEGES;

exit;

Hauv no koj tab tom yuav hloov lub username nrog koj lo lus zais rau lub chaw khaws ntaub ntawv.

PHP installation

Txhawm rau nruab PHP nrog txhua yam nws tsim nyog yuav tsum tau ua thiab cov qauv siv, khiav lub nram qab no hais kom ua:

sudo apt-tau nruab php-fpm php-curl php-mysql php-gd php-mbstring php-xml php-xmlrpc -y

Ua li no raulub sij hawm peb tab tom yuav hloov php.ini ntawv.

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

Y saib rau kab no:

;cgi.fix_pathinfo=1

Peb yuav tsum uncomment txoj kab tshem tawm qhov; hloov qhov = 1 txog = 0, tseem nyob raws li nram no:

cgi.fix_pathinfo=0

Tom qab peb yuav saib rau cov kab hauv qab no hauv php.ini ntawv thiab muab cov nqi hauv qab no, lawv yuav tsum zoo li no:

upload_max_filesize = 100M
post_max_size = 1000M
memory_limit = 1000M
max_execution_time = 120

Rub tau WordPress

Wordpres-ubuntu

Tam sim no cia peb download tau lub vev xaib kawg ntawm WordPress thiab peb yuav muab nws tso rau hauv lub neej ntawd Nginx directory:

cd /var/www/html

wget https://wordpress.org/latest.tar.gz

Unzip cov ntaub ntawv nyuam qhuav rub tawm nrog:

tar -zxvf latest.tar.gz --strip-components=1

Tam sim no peb hloov pauv cov kev tso cai los ntawm Nginx nplaub tshev:

chown -R www-data:www-data /var/www/html/
chmod -R 755

Ua li no wb tsim ib cov ntaub ntawv configuration nrog:

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

Y peb muab cov hauv qab no:

server {
listen 80;
listen [::]:80;
root /var/www/html;
index index.php index.html index.htm;
server_name example.com www.example.com;
client_max_body_size 500M;
location / {
try_files $uri $uri/ /index.php?$args;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

Tam sim no peb yuav tsum pab kom nws nrog:

ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

Tam sim no rov pib dua Nginx thiab PHP rau cov kev hloov kom mus tau txais txiaj ntsig

sudo systemctl restart nginx.service
sudo systemctl restart php7.2-fpm.service

Teeb WordPress

Tam sim no cia peb hloov ua WordPress cov ntaub ntawv teeb tsa qhov twg peb yuav tso cov peev xwm ntawm cov ntaub ntawv:

mv /var/www/html/wp-config-sample.php /var/www/html/wp-config.php

sudo nano /var/www/html/wp-config.php

Y peb yuav hloov cov ntaub ntawv hauv nws:

define('DB_NAME', 'wordpress');
define('DB_USER', 'usuario-de-la-base-de-datos');
define('DB_PASSWORD', 'contraseña-de-la-base-de-datos');

Ua li no rau kev ruaj ntseg, lawv yuav tsum hloov kho cov yuam sij kev nyab xeeb hauv koj wp-config.

Yog li ntawd peb yuav tsum tsim kom muaj lawv, peb ua qhov no los ntawm kev mus saib qhov txuas no thiab peb hloov lub txiaj ntsig uas lub xaib no muab peb hauv peb cov ntaub ntawv teeb tsa.

Thiab ua nrog nws Peb twb muaj WordPress nruab rau hauv peb qhov system.

Txhawm rau siv nws yooj yim Peb yuav tsum qhib qhov browser thiab qhov chaw nyob ntawm qhov chaw nyob ntawm txoj kab uas peb muaj wordpress / var / www / html / lossis peb tus ip chaw nyob.


Cov ntsiab lus ntawm tsab xov xwm ua raws li peb cov ntsiab cai ntawm kev tswj hwm kev ncaj nceesCov. Tshaj tawm ib qho yuam kev nyem no.

2 lus, tawm koj li

Tso koj saib

Koj email chaw nyob yuav tsis tsum luam tawm. Yuav tsum tau teb cov cim nrog *

*

*

  1. Lub luag haujlwm rau cov ntaub ntawv: Miguel Ángel Gatón
  2. Lub hom phiaj ntawm cov ntaub ntawv: Tswj SPAM, kev tswj xyuas tawm tswv yim.
  3. Sau raws cai: Koj kev tso cai
  4. Kev sib txuas lus ntawm cov ntaub ntawv: Cov ntaub ntawv yuav tsis raug xa mus rau lwm tus neeg thib peb tsuas yog los ntawm kev txiav txim siab raug cai.
  5. Cov ntaub ntawv khaws cia: Cov Ntaub Ntawv khaws tseg los ntawm Occentus Networks (EU)
  6. Txoj Cai: Txhua lub sijhawm koj tuaj yeem txwv, rov qab thiab tshem tawm koj cov ntaub ntawv.

  1.   pob zeb said

    Tam sim no peb tab tom hloov pauv cov kev tso cai ntawm Nginx nplaub tshev:

    chown -R www-data: www-data / var / www / html /
    xwm -R 755

    Yuam kev tom qab chmod -R 755 (ploj ntwg ntu)

  2.   Koos loos said

    Thov kho sudo apt-tau txawj tej yam ntxiv & & sudo apt-tau txawj tej yam ntxiv -y

    los ntawm

    sudo apt-tau hloov tshiab & & sudo apt-tau txawj tej yam ntxiv -y