Install LEMP and WordPress on Ubuntu 16.04
Yesterday, there was a need to deploy WordPress on Ubuntu server, I haven’t touched WordPress for more than two years, so I have to check the information and read how to install it. Most of the tutorials use LNMP, and most of them use PHP5.6, after all, WordPress is also a few years, here to record the installation process, to facilitate the next query.
WordPress is a blog system implemented by MySQL and PHP technology stacks. It has been in existence for more than a decade, because of its high usability, rich popularity of themes and plug-ins, although it has rarely appeared in public view in recent years. There have been quite a few blog system contenders, but it is undeniable that WordPress is perfect if you want to quickly develop a blog system with a focus on writing articles and not spending too much time on the page. Meet the requirements, if you are skilled, you can build a blog system in a few minutes, and then take a few minutes to choose a relatively simple and generous theme, which is extremely efficient.
To install WordPress, you must first have a PHP and MySQL environment. It is best to have a port forwarding application. Nginx and Apache are optional. These are conflicts, so you can only choose one. This article takes LNMP as an example.
Just in case, it’s good to confirm that the Apache related application has been removed.
apt remove apache2*
just use apt.
apt install nginx
Then use the following code to start the service, at this point we can see the default Nginx page by visiting the domain/IP.
service nginx start
apt install mysql-server
The password must be remembered, otherwise, it is quite troublesome to reset and change the password.
apt install php php-fpm php7.0-mysql
- Create a php file
Edit this file
Then modify the configuration of Nginx
Mainly modify the root location.
After modification, restart Nginx with the following code to ensure that the new configuration file is read.
service nginx restart
Then visit through the browser to see if there is a normal parsing to the php info page.
After the previous steps, the WordPress environment is installed. Next, install WordPress. First, we must first configure the MySQL database.
mysql -u root -p
After entering the MySQL command line
create database wordpress character set utf8 collate utf8_bin;
grant all privileges on wordpress.* to wordpressuser@localhost identified by "[insert-password-here]";
Be careful to replace the password set in the previous steps.
After you finish, you can start downloading WordPress. There are Chinese station and official English station. Both are the same, but the default language package is different. If you download the language package in any version, you can switch to another version.
Here is the official version.
Modify the values of
DB_PASSWORD, and then migrate the directory to
cp -r ~/wordpress/* /var/www/html
It should be noted that the current WordPress part of the configuration is over, then you want to access, you also need to modify the Nginx configuration, the request is configured to the WordPress directory.
After installing WordPress, when you need to upload files, you may not have the permission of the superior directory. You need to modify the permissions of the corresponding folder and its parent folder. It is relatively convenient to change to 777. Be careful not to make mistakes in the modified folder. It is not necessarily a folder named after WordPress.