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

How to deploy WordPress on Ubuntu LNMP

藏色散人
Release: 2021-05-14 15:12:17
forward
2152 people have browsed it

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
Copy after login

2. Then, install PHP7.1

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

sudo apt-get -y install mysql-server-5.7
Copy after login

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
Copy after login
Configure Mysql

Log in through the following command

mysql:

mysql -u root -p
Copy after login
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
Copy after login
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
Copy after login
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;
 }
Copy after login
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);
Copy after login
Install other php extensions

sudo apt install -y php7.1-gd php7.1-mbstring php7.1-xmlrpc
Copy after login

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template