Centos7 wordpress configuration based on lnmp

Source: Internet
Author: User
Tags install wordpress wordpress database

Centos7 wordpress configuration based on lnmp

1. Download and install WordPress

Wget http://wordpress.org/latest.zip # download WordPress installation files

Unzip latest.zip # decompress the Installation File

Because discuz is installed on my host, it may be a problem to delete all discuz files first. After studying WordPress, we will study two coexistence issues.

Rm-rf var/www/html # Delete

Mkdir-p/var/www/html # create the website root directory

Cp-rf wordpress/*/var/www/html/# copy the installation file to the website root directory

Chmod-R 777/var/www/html # Change root directory permissions

2. Create a WordPress Database

Mysql-u root-p

> Create database wordpress;

> Grant all privileges on wordpress. * to wordpress @ 'localhost' identified by 'Password ';

> Flush privileges;

> Exit

3. Modify the WordPress configuration file

Cd/var/www/html # enter the Directory

Cp wp-config-sample.php wp-config.php # copy a file

Vi wp-config.php # edit configuration file

# Modify the following content:

/** The name of the database for WordPress */
Define ('db _ name', 'wordpress '); # Database NAME

/** MySQL database username */
Define ('db _ user', '# Your user'); # Database USER

/** MySQL database password */
Define ('db _ password', '# Your password'); # Database PASSWORD

/** MySQL hostname */
Define ('db _ host', 'localhost'); # whether the HOST can be changed or not

Systemctl restart nginx

Systemctl restart mariadb # restart the service

Open 192.168.100.13/wordpress in the browser to log on to the wordpress page.

4. When I opened the WordPress interface, the 404 code was displayed to modify the nginx file.

Vi/etc/nginx. conf

# Add the following content to server {}

If (-f $ request_filename/index.html ){
Rewrite (. *) $1/index.html break;
}
If (-f $ request_filename/index. php ){
Rewrite (. *) $1/index. php;
}
If (! -F $ request_filename ){
Rewrite (. *)/index. php;
}

Rewrite/wp-admin $ scheme: // $ host $ uri/permanent;

Systemctl restart nginx

Systemctl restart mariadb # restart the service

Open the website 192.168.100.13/wordpress and log on to start configuring WordPress.

Related Article

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.