Ubuntu 18.04 安装wordpress

查看系统版本

lsb_release -a

Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

下载并解压

https://wordpress.org/download/releases/

wget https://wordpress.org/wordpress-5.2.2.zip #下载源码
sudo apt install unzip #安装 unzip
unzip wordpress-5.2.2.zip # 解压

PHP

sudo apt install -y php php-fpm php-mysql

php -v
# PHP 7.2.19-0ubuntu0.18.04.1 (cli)

MariaDB

sudo apt install -y mariadb-server mariadb-client
mysql -V

# mysql  Ver 15.1 Distrib 10.1.40-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Nginx

sudo apt install -y nginx

nginx -v
# nginx version: nginx/1.14.0 (Ubuntu)
server {
    listen 80;
    server_name codingday.network;
    root <目录>;
    index index.php index.html index.htm index.nginx-debian.html;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

# /etc/nginx/sites-enabled

数据库

CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

GRANT ALL ON wordpress.* TO ' wordpress '@'localhost' IDENTIFIED BY 'wordpress';

FLUSH PRIVILEGES;

cp wp-config-sample.php wp-config.php

/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );

/** MySQL database username */
define( 'DB_USER', 'wordpress' );

/** MySQL database password */
define( 'DB_PASSWORD', 'wordpress' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

sudo chown -R www-data:www-data wordpress


sudo lsof -Pn -iTCP:3306


参考:

https://linuxize.com/post/how-to-install-mariadb-on-ubuntu-18-04
https://www.hostinger.com/tutorials/how-to-install-wordpress-on-ubuntu-using-lamp-stack
https://github.com/kevinoid/postgresql-for-wordpress
http://www.voidcn.com/article/p-pavmiupn-bqw.html

你可能感兴趣的:(Ubuntu 18.04 安装wordpress)