Install WordPress in Ubuntu 14.04 Based on Nginx

Source: Internet
Author: User
Tags install wordpress wordpress version

Install WordPress in Ubuntu 14.04 Based on Nginx

Introduction:

WordPress is the most popular CMS system in the world. It is very easy to build and manage its own personal homepage or blog.

This article mainly teaches you how to use Nginx, PHP, and MySQL to build your own WordPress System in Ubuntu 14.04.

Prerequisites:

First, you must have a Ubuntu14 system that can access the Internet, and then install the LEMP software. For details, see the link for installing the LEMP service and phpMyAdmin on Ubuntu 14.10/14.04/13.10:

Sudo apt-get update
Sudo apt-get install nginx mysql-server php5-fpm php5-mysql

Step 1: create databases, users, and permissions for WordPress:
When you install mysql-server, the system prompts you to enter the password for the root user to log on to the database. To create a database, follow these steps:

Mysql-u root-p
Create database wordpress;
Create user wordpresSUSEr @ localhost identified by 'Password ';
Grant all privileges on wordpress. * TO wordpressuser @ localhost;
Flush priveleges;
Exit

Step 2: download the latest WordPress version and install some PHP components required by WordPress:
Cd
Wget https://wordpress.org/latest.tar.gz
Tar zxvf latest.tar.gz
Cd wordpress
Apt-get install php5-gd libssh2-php

Step 3: Configure WordPress:
Cd wordpress
Cp wp-config-sample.php wp-config.php

Then edit the wp-config.php and change the following: the database name is the name of the database you created, and then change the username and password you created.
// ** MySQL settings-You can get this info from your web host **//
/** The name of the database for WordPress */
Define ('db _ name', 'wordpress ');
/** MySQL database username */
Define ('db _ user', 'wordpressuser ');
/** MySQL database password */
Define ('db _ password', 'Password ');

Step 4: copy the configuration file to the root directory of the website:

Rsync-avP ../wordpress // var/www/html/
J ht (read this article if you do not understand this command)
Mkdir-p wp-content/upload
Chown-R www-data:/var/www/html/* (the user name of the file owner permission here should be consistent with your Nginx user name)

Note that if wordpress/is used in the directory after rsync, copy all the files in the directory to the html directory. If it is wordpress, there is no /, the concept is to copy the workdpress directory to the html directory.

Step 5: configure the Nginx file:
Cp/etc/nginx/sites-available/default/etc/nginx/sites-available/wordpress
Vi/etc/nginx/sites-available/wordpress

The changes are shown in the red font:
Server {
Listen 80 default_server;
Listen [:]: 80 default_server defaults 6only = on;
Root/var/www/html;
Index. php index.html index.htm;
Server_name your_domain.com;
Location /{
# Try_files $ uri/= 404;
Try_files $ uri // index. php? Q = $ uri & $ args;
}
Error_page 404/404 .html;
Error_page 500 502 503 x.html;
Location =/50x.html {
Root/usr/share/nginx/html;
}
Location ~ \. Php $ {
Try_files $ uri = 404;
Fastcgi_split_path_info ^ (. + \. php) (/. +) $;
Fastcgi_pass unix:/var/run/php5-fpm.sock;
Fastcgi_index index. php;
Include fastcgi_params;
}
}

When the code is changed to the bash format, the red annotation is removed. The changed content is that the root directory points to/var/www/html, and the index is searched first. php, change server_name, and change the location/try_files method.

Create a soft connection to site-enabled, delete the default, and restart Nginx and php5.

Ln-s/etc/nginx/sites-available/wordpress/etc/nginx/sites-enabled/
Rm/etc/nginx/sites-enabled/default
Service nginx restart
Service php5-fpm restart

Step 6: Configure WordPress based on the web page:

Enter your domain name or IP address to enable the initial installation of WordPress,

After the installation is complete, enter the user name and password to access your blog.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.