Home > System Tutorial > LINUX > body text

How to configure wordpress in centos7 based on lnmp

王林
Release: 2024-04-10 17:28:08
forward
1136 people have browsed it

How to configure wordpress in centos7 based on lnmp

1.下载安装WordPress
wget http://wordpress.org/latest.zip     #下载WordPress安装文件

unzip latest.zip    #解压安装文件
Copy after login

由于我的主机装有discuz  所以会有点问题  先把discuz的文件全删了研究下WordPress  后面再研究两个共存的事

rm -rf var/www/html    #删除

mkdir -p /var/www/html    #创建网站根目录

cp -rf wordpress/* /var/www/html/      #复制安装文件到网站根目录

chmod -R 777 /var/www/html     #更改根目录权限
Copy after login
2.数据库创建WordPress数据库
mysql -u root -p

>create database wordpress;

>grant all privileges on wordpress.* to wordpress@'localhost' identified by 'password';

>flush privileges;

>exit
Copy after login
3.修改WordPress配置文件
cd /var/www/html      #进入目录

cp wp-config-sample.php wp-config.php     #复制一个文件

vi wp-config.php     #编辑配置文件
Copy after login

#修改如下内容

/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');            #数据库名称

/** MySQL database username */
define('DB_USER', '#你的用户');                        #数据库用户

/** MySQL database password */
define('DB_PASSWORD', '#你的密码');             #数据库密码

/** MySQL hostname */
define('DB_HOST', 'localhost');            #主机  可改可不改

systemctl restart nginx

systemctl restart mariadb          #重启服务
Copy after login

在浏览器中打开 192.168.100.13/wordpress   登陆wordpress界面

 

4.我打开WordPress界面的时候出现了404代码   修改nginx文件
vi /etc/nginx/nginx.conf

#在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          #重启服务

打开网址   192.168.100.13/wordpress  登陆开始配置WordPress
Copy after login

The above is the detailed content of How to configure wordpress in centos7 based on lnmp. For more information, please follow other related articles on the PHP Chinese website!

source:linuxprobe.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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!