search
HomeSystem TutorialLINUXHow to configure wordpress in centos7 based on lnmp

How to configure wordpress in centos7 based on lnmp

Apr 10, 2024 pm 05:28 PM
mysqllinuxcentosnginxlinux tutorialRed Hatlinux systemlinux commandlinux certificationred hat linuxlinux video

How to configure wordpress in centos7 based on lnmp

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

unzip latest.zip    #解压安装文件

由于我的主机装有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     #更改根目录权限
2.数据库创建WordPress数据库
mysql -u root -p

>create database wordpress;

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

>flush privileges;

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

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

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

#修改如下内容

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

在浏览器中打开 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

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!

Statement
This article is reproduced at:Linux就该这么学. If there is any infringement, please contact admin@php.cn delete
What is AI? A Beginner's Guide for Linux UsersWhat is AI? A Beginner's Guide for Linux UsersMay 07, 2025 am 11:23 AM

Artificial Intelligence (AI) is a term that’s been buzzing around for a while now, from self-driving cars to voice assistants like Siri and Alexa, AI is becoming a part of our everyday lives. But what exactly is AI, and why should Linux users care ab

50 Essential Linux Commands for Beginners and SysAdmins50 Essential Linux Commands for Beginners and SysAdminsMay 07, 2025 am 11:12 AM

For someone new to Linux, using it can still feel challenging, even with user-friendly distributions like Ubuntu and Mint. While these distributions simplify many tasks, some manual configuration is often required, but fully harnessing the power of L

How to Set Up Your Linux System for AI DevelopmentHow to Set Up Your Linux System for AI DevelopmentMay 07, 2025 am 10:55 AM

In the previous article, we introduced the basics of AI and how it fits into the world of Linux. Now, it’s time to dive deeper and set up your Linux system to start building your first AI model. Whether you’re a complete beginner or have some exper

How to Install Kloxo Web Hosting Control Panel in LinuxHow to Install Kloxo Web Hosting Control Panel in LinuxMay 07, 2025 am 10:52 AM

If you’re looking to manage your server with ease, Kloxo is a great option, as it is free and open-source web hosting control panel that allows you to manage your server and websites with a simple, user-friendly interface. In this guide, we’ll walk

How to Move Files and Folders with Spaces in LinuxHow to Move Files and Folders with Spaces in LinuxMay 07, 2025 am 10:17 AM

If you’ve ever found yourself in a situation where you’re trying to move a bunch of files and folders, only to be stumped by spaces in the folder names, you’re not alone. Spaces in filenames or folder names can quickly become a frustrat

7 Best Linux Distros for KDE Plasma Fans in 20257 Best Linux Distros for KDE Plasma Fans in 2025May 07, 2025 am 10:06 AM

The KDE Plasma desktop is renowned for its sleek design, extensive customization options, and impressive performance. For users who appreciate a polished, modern interface with the flexibility to tweak every detail, Plasma is a dream come true. But w

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.