Nginx 实现LNMP+kodcloud站点搭建实验
Posted 林炜玮_51CTO
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Nginx 实现LNMP+kodcloud站点搭建实验相关的知识,希望对你有一定的参考价值。
Centos8部署LNMP+kodcloud
安装程序
dnf -y install nginx php php-json php-mysqlnd mariadb-server redis
systemctl enable --now php-fpm nginx.service mariadb.service redis.service
systemctl status php-fpm.service nginx.service mariadb.service redis.service
部署mariadb
mysql
create database kodbox;
create user kodbox@172.16.10.% identified by 123456;
grant all on kodbox.* to kodbox@172.16.10.%;
#退出数据库
sed -i s/^bind.*/bind 0.0.0.0/ /etc/redis.conf
[root@Centos8 ~]# grep bind /etc/redis.conf
# By default, if no "bind" configuration directive is specified, Redis listens
# the "bind" configuration directive, followed by one or more IP addresses.
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
# internet, binding to all the interfaces is dangerous and will expose the
# following bind directive, that will force Redis to listen only into
bind 0.0.0.0
# 1) The server is not binding explicitly to a set of addresses using the
# "bind" directive.
# are explicitly listed using the "bind" directive.
部署php
vim /etc/php-fpm.d/www.conf
#注意php文件的注释用的是;
24 user = nginx #默认是apche
26 group = nginx #默认是apche
38 ;listen = /run/php-fpm/www.sock #默认监听套接字,注释,也可以改成监听本机127.0.0.1:9000
39 listen = 127.0.0.1:9000
64 listen.allowed_clients = 127.0.0.1 #默认允许本机访问,如果是其他机器此处修改
240 pm.status_path = /status #状态页打开,要和Nginx配置同名
252 ping.path = /ping #ping打开
#保存退出
echo "<?php phpinfo(); ?>" > /usr/share/nginx/html/index.php
查看PHP测试页:浏览器输入172.16.10.12/index.php
部署Nginx
mkdir /etc/data/php/kodbox -pv
vim /etc/nginx/conf.d/kodbox.conf
server
listen 80;
server_name pc.linweiwei.com;
root /usr/share/nginx/html;
location ~ \\.php$
root /etc/data/php/kodbox;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
nginx -t
nginx -reload
修改host文件
部署kodcloud
上传已经下载好的安装包,或去官网下载 https://cn.wordpre
wget https://static.kodcloud.com/update/download/kodbox.1.26.zip
unzip kodbox.1.26.zip -d /etc/data/php/kodbox/
chown -R nginx.nginx /etc/data/php/kodbox/
登陆测试安装成功
以上是关于Nginx 实现LNMP+kodcloud站点搭建实验的主要内容,如果未能解决你的问题,请参考以下文章
Nginx 实践案例(yum安装方式):利用LNMP实现可道云盘