Android

Kuinka asentaa wordpress apache -sovelluksella centos 7: lle

Introduction to Amazon Web Services by Leo Zhadanovsky

Introduction to Amazon Web Services by Leo Zhadanovsky

Sisällysluettelo:

Anonim

WordPress on maailman suosituin avoimen lähdekoodin blogi ja CMS-alusta, joka tarjoaa nykyään neljänneksen kaikista Internetin verkkosivustoista. Se perustuu PHP: hen ja MySQL: ään, ja siinä on paljon ominaisuuksia, joita voidaan laajentaa ilmaisilla ja premium-laajennuksilla ja teemoilla. WordPress on yksinkertaisin tapa luoda verkkokauppa, verkkosivusto tai blogi.

Tässä opetusohjelmassa selitetään kuinka WordPress asennetaan CentOS 7: een. Tämän artikkelin kirjoittamishetkellä WordPressin uusin versio on versio 5.0.3.

Käytämme LAMP-pinoa Apachen kanssa Web-palvelimena, SSL-varmenteen, uusimman PHP 7.2: n ja MySQL / MariaDB: n tietokantapalvelimena.

edellytykset

Varmista ennen tämän oppaan jatkamista, että seuraavat edellytykset täyttyvät:

  • Verkkotunnus osoitti palvelimen julkiseen IP-osoitteeseen. Käytämme example.com Sisäänkirjautuneena käyttäjänä, jolla on sudo-oikeudet.Apache asennettuna seuraa näitä ohjeita.PHP 7.2 asennetaan seuraavien ohjeiden mukaisesti.Valitset verkkotunnuksellesi SSL-varmenteen. Voit luoda ilmaisen Let's Encrypt SSL -sertifikaatin noudattamalla näitä ohjeita.

MySQL-tietokannan luominen

WordPress tallentaa tiedot ja kokoonpanon MySQL-tietokantaan. Jos sinulla ei vielä ole MySQL tai MariaDB asennettuna CentOS-palvelimellesi, voit asentaa noudattamalla yhtä alla olevista oppaista:

  • Asenna MySQL CentOS 7: ään.Asenna MariaDB CentOS 7: ään.

Kirjaudu MySQL-shelliin suorittamalla seuraava komento:

mysql -u root -p

Suorita seuraava SQL-käsky MySQL-kuoren sisällä luodaksesi uuden wordpress tietokannan:

CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Seuraavaksi luo MySQL-käyttäjätili nimeltä wordpressuser ja myönnä tarvittavat käyttöoikeudet käyttäjälle suorittamalla seuraava komento:

GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'change-with-strong-password';

Kun olet valmis, poistu mysql-konsolista kirjoittamalla:

EXIT;

Lataa Wordpress

Seuraava komento lataa uusimman WordPress-version WordPress-lataussivulta wgetillä ja purkaa arkiston verkkotunnuksen asiakirjajuurikansioon:

wget -q -O - "http://wordpress.org/latest.tar.gz" | sudo tar -xzf - -C /var/www/html --transform s/wordpress/example.com/

Aseta oikeat käyttöoikeudet, jotta Web-palvelimella on täysi pääsy sivuston tiedostoihin ja hakemistoihin:

sudo chown -R apache: /var/www/html/example.com

Apachen määrittäminen

Tähän mennessä sinulla pitäisi olla jo asennettuna Apache SSL-varmenteella järjestelmään, ellei tarkista tämän oppaan edellytyksiä.

Avaa tekstieditori ja muokkaa verkkotunnuksen Apache-virtuaalisten isäntien kokoonpanoa:

sudo nano /etc/httpd/conf.d/example.com.conf

Muista korvata example.com Wordpress-verkkotunnuksellasi ja määrittää oikea polku SSL-varmennetiedostoihin.

/etc/httpd/conf.d/example.com.conf

ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ DirectoryIndex index.html index.php DocumentRoot /var/www/html/example.com ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem Options FollowSymLinks AllowOverride All Require all granted ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ DirectoryIndex index.html index.php DocumentRoot /var/www/html/example.com ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem Options FollowSymLinks AllowOverride All Require all granted ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ DirectoryIndex index.html index.php DocumentRoot /var/www/html/example.com ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem Options FollowSymLinks AllowOverride All Require all granted ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ DirectoryIndex index.html index.php DocumentRoot /var/www/html/example.com ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem Options FollowSymLinks AllowOverride All Require all granted ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ DirectoryIndex index.html index.php DocumentRoot /var/www/html/example.com ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem Options FollowSymLinks AllowOverride All Require all granted

Kokoonpano käskee Apache -sovelluksen ohjaamaan uudelleen verkkotunnuksesi http : een https ja www : n non-www versioon.

Käynnistä Apache-palvelu uudelleen, jotta muutokset tulevat voimaan:

sudo systemctl restart

Viimeistele WordPress-asennus

Nyt kun Wordpress on ladattu ja Apache-palvelin on määritetty, voit lopettaa asennuksen verkkoliittymän kautta.

Avaa selain, kirjoita verkkotunnuksesi ja seuraavanlainen näyttö tulee näkyviin:

Täältä voit aloittaa WordPress-asennuksen mukauttamisen asentamalla uusia teemoja ja laajennuksia.

johtopäätös

Onnittelut, että WordPress on asennettu onnistuneesti Apachen kanssa CentOS 7 -palvelimeesi. WordPressin ensimmäiset vaiheet on hyvä lähtökohta oppia lisää WordPressin käytön aloittamisesta.

centos wordpress mysql mariadb cms apache