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
瀏覽器點擊現在安裝