Home >CMS Tutorial >WordPress >How to deploy WordPress on Ubuntu LNMP

How to deploy WordPress on Ubuntu LNMP

藏色散人
藏色散人forward
2021-05-14 15:12:172148browse

The following tutorial column from WordPress will introduce to you how to deploy WordPress with Ubuntu LNMP. I hope it will be helpful to friends in need!

Software version description:

  • Ubuntu: 16.04 LTS;

  • WordPress: 4.7 zh-CN

##Applicable people: Junior

Getting started with PHP Readers and the majority of designers who want to have their own sites!

Install PHP7.1

1. First add PPA

sudo apt-get update
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php -y
sudo apt-get update

2. Then, install PHP7.1

sudo apt-get -y install php7.1
sudo apt-get -y install php7.1-mysql php7.1-fpm
Install Mysql

sudo apt-get -y install mysql-server-5.7

Set the password, OK.

At this point, the basic WordPress environment is ready.

Deploy WordPress

First pull the WordPress source code through git:

git clone https://github.com/JellyBool/wordpress.git /var/www/wordpress
Configure Mysql

Log in through the following command

mysql:

mysql -u root -p
Execute in mysql:

CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

CREATE USER 'jellybool' IDENTIFIED BY 'laravist';
GRANT ALL PRIVILEGES ON wordpress.* TO 'jellybool';

quit
Note that the above

jellybool and laravist are set according to your own needs .

Configure Nginx

Open the configuration file:

vim /etc/nginx/sites-available/default
Configure the following configuration:

root /var/www/wordpress;

index index.php index.html index.htm index.nginx-debian.html;
# 注意我们添加了 index.php

location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
 }
Access your domain name, you can perform very famous The

WordPress five-minute installation process! After installation is complete, you have a WordPress site!

Finally

Configure WordPress file upload, open the

wp-config.php file:

define('FS_METHOD', 'direct');
define('FS_CHMOD_DIR', 0777);
define('FS_CHMOD_FILE', 0777);
Install other php extensions

sudo apt install -y php7.1-gd php7.1-mbstring php7.1-xmlrpc

At this point, the work is done.

The above is the detailed content of How to deploy WordPress on Ubuntu LNMP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete