使用lnmp安装wordpress

注:本次使用的操作系统为centos7

1、关闭防火墙与selinux

systemctl stop firewalld
setenforce 0  

2、配置yum源

​ vi /etc/yum.repos.d/centos.repo

[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1

[lnmp]
name=lnmp
baseurl=file:///root/lnmp
gpgcheck=0
enabled=1

3、安装环境

yum install nginx mariadb-server php php-mysql php-fpm
systemctl start nginx mariadb php-fpm
systemctl status mariadb nginx php-fpm

此时即可查看nginx的默认界面

4、修改配置文件

vim /etc/nginx/conf.d/default.conf

将:
location / {
     root   /usr/share/nginx/html;
     index  index.html index.htm; 
修改为:
location / {
     root   /usr/share/nginx/html;
     index  index.php index.html index.htm;

将:
#location ~ \.php$ {
#    root           html;
#    fastcgi_pass   127.0.0.1:9000;
#    fastcgi_index  index.php;
#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
#    include        fastcgi_params;
#}
修改为:
    location ~ \.php$ {
        root           /usr/share/nginx/html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

​ systemctl restart nginx

vim /etc/php-fpm.d/www.conf

将:
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache
修改为:
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx

​ systemctl restart php-fpm

vim /usr/share/nginx/html/test.php ————>创建一个测试页面

<?php
phpinfo();
?>

curl http://192.168.100.20/test.php(也可用浏览器访问)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<style type="text/css">
body {background-color: #ffffff; color: #000000;}
body, td, th, h1, h2 {font-family: sans-serif;}
pre {margin: 0px; font-family: monospace;}
a:link {color: #000099; text-decoration: none; background-color: #ffffff;}
a:hover {text-decoration: underline;}
table {border-collapse: collapse;}
.center {text-align: center;}
.center table { margin-left: auto; margin-right: auto; text-align: left;}
.center th { text-align: center !important; }
td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}
······················

在这里插入图片描述

5、处理wordpress

[root@localhost ~]# yum -y install unzip
[root@localhost ~]# unzip wordpress-4.7.3-zh_CN.zip 
[root@localhost ~]# mv /root/wordpress/* /usr/share/nginx/html/

浏览器访问:192.168.100.20 即可进入

在这里插入图片描述

点击开始:

6、初始化mariadb数据库

[root@localhost ~]# mysql_secure_installation
回车
回车
密码
确认密码
回车
回车
回车
回车
[root@localhost ~]# mysql -uroot -p000000
MariaDB [(none)]> show databases;                     查看数据库
MariaDB [(none)]> create database wordpress;          创建数据库

7、初始化wordpress

填写以下信息
在这里插入图片描述

点击提交,进入以下页面

在这里插入图片描述

[root@localhost ~]# vim /usr/share/nginx/html/wp-config.php       在此目录下创建文件
并将它所给的内容复制到该文件内,并点击安装

填写以下信息:

在这里插入图片描述

完成

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值