lnmp上线博客

LNMP上线论坛

1.准备工作
**关闭防火墙以及Selinux

systemctl stop firewalld		立即停止防火墙
systemctl disable firewalld		设置开机禁用防火墙

setenforce 0		立即关闭selinux
vim /etc/sysconfig/selinux		设置永久关闭,必须下次重启才有效
SELINUX=disabled

2.安装需要的组件

Mariadb、mariadb-server 数据库
Php、php-mysql、php-fpm php-mariadb
Gcc、gcc-c++、pcre-devel、openssl-devel、zlib、zlib-devel 依赖环境
xftp 上传工具

3.安装nginx

或用网络的本版本的yum源来装nginx

启动nginx 进行测试服务是否启动 打开浏览器访问:http://IP

出现以下页面证明成功!

在这里插入图片描述
4.nginx和php整合

vim /etc/nginx/nginx.conf

将第45行index后添加index.php
而后找到65-71行。将注释去掉
修改69行为
在这里插入图片描述
保存退出,重启 nginx

进入nginx服务的网站根目录

[root@localhost~]# cd /usr/share/nginx/html/
[root@localhost html]# vim /index.php
<?php
phpinfo();
?>

保存退出
重启
浏览器访问测试页面

5.上传博客活或论坛

[root@localhost~]# tar zxf wordpress-4.9.4-ZH_CN.tar.gz -C /usr/src/   #解压博客压缩包
[root@localhost~]# cd /usr/src/wordpress-4.9.4   #进入博客目录
[root@localhost wordpress-4.9.4]# cp -r wordpress-4.9.4 /usr/share/nginx/html   #将wordpress里面所有的目录以及文件全部拷贝到nginx的网页根目录下

访问网页wordpress

6.配置数据库

启动数据库
mysql登录

create database wordpress;  #创建数据库
grant all privileges on *.* to test@'localhost' identified by 'centos'  #授权用户密码 
flush privileges; #刷新权限
exit #退出

systemctl restart nginx

再次测试访问:ip地址/wordpress

遇到这种情况的话
在这里插入图片描述

[root@localhost html]# cd wordpress/
[root@localhost wordpress]# cp wp-config-sample.php  wp-config.php 
[root@localhost wordpress]# vim wp-config.php 

浏览器点击现在安装
在这里插入图片描述

发布了34 篇原创文章 · 获赞 13 · 访问量 525

猜你喜欢

转载自blog.csdn.net/qq_45019159/article/details/103779508
今日推荐