Linux搭建博客系统LNMP
linux 博客系统
基于LNMP安装博客系统
Linux nginx mysql php
先将lnmp和wordpress上传至虚拟机
下载unzip解压两个软件
yum -y install unzip
unzip lnmp.zip
unzip wordpress-4.7.3-zh_CN.zip
配置lnmp的仓库
cat >> /etc/yum.repos.d/local.repo <<q
[lnmp]
name=lnmp
baseurl=file:///root/LNMP/lnmp/lnmp
gpgcheck=0
enabled=1
q
yum -y install nginx mariadb-server php php-mysql php-fpm
配置nginx,修改nginx配置文件
vi /etc/nginx/conf.d/default.conf
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm; #这行加个index.php
}
30-36行注释去掉,修改以下两处参数
location ~ \.php$ {
root /usr/share/nginx/html; #改html为/usr/share/nginx/html
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #改/scripts为$document_root
include fastcgi_params;
}
然后启动nginx
systemctl start nginx
配置mysql
systemctl start mariadb
systemctl enable mariadb
mmysql_secure_installation
Disallow root login remotely 为no其他为yes
mysql -uroot -p000000
create database wordpress;
exit
配置php,导入wordpress
cd ~
cd wordpress
cp -ar * /usr/share/nginx/html/
cd /usr/share/nginx/html/
chmod -R 777 ./
systemctl start php-fpm
systemctl enable php-fpm
查看端口
netstat -ntpl
-> 3306:mysqld
-> 9000:php-fpm
-> 80:nginx