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();
?>
保存退出
重启
浏览器访问测试页面
扫描二维码关注公众号,回复:
8509288 查看本文章
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
浏览器点击现在安装