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.