使用centOS7+nginx+PHP搭建可道云(kodexplorer)

1.防火墙操作

# 停止防火服务
[root@localhost ~]# systemctl stop firewalld
# 查看防火墙的当前状态
[root@localhost ~]# systemctl status firewalld
# 开机禁止启动防火墙
[root@localhost ~]# systemctl disable firewalld
或者防火墙开开启指定端口

2.配置 SELINUX

#重启后永久生效
[root@localhost ~]# vi /etc/selinux/config
SELINUX=disabled
#临时生效
[root@localhost ~]# setenforce 0

安装nginx

yum install -y nginx
# 查看版本
nginx -v
nginx version: nginx/1.20.1
#启动服务
systemctl start nginx

安装完成后默认服务是启动状态,可以直接在浏览器中输入http://localhost 就能看到默认nginx首页

安装php环境

#安装
yum install -y php php-fpm
#安装完成,查看版本
php -v

 从nginx的配置文件/etc/nginx/nginx.conf中可以看到默认网页存储位置是/usr/share/nginx/html,在这个目录下新建一个text.php文件,里面只写入一行内容:

<?php phpinfo(); ?>

此时再次访问http://localhost/test.php, 并没有打开php相关信息的网页,而是直接下载了这个文件。此时还需要对nginx配置做一些调整

vim /etc/nginx/nginx.conf
#在默认80端口的server节点中新增下面的内容,用于拦截.php结尾的请求,并把这种请求转发到php-fpm默认监听的9000端口
location / {
        try_files $uri $uri/ /index.php$is_args$args;
}

location ~ \.php$ {
        try_files $uri =404;
        include fastcgi.conf;
        fastcgi_pass 127.0.0.1:9000;
}

#然后启动php-fpm服务
systemctl start php-fpm

#查看php-fpm状态,如下是正常启动
systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-09-24 23:52:32 CST; 1s ago
 Main PID: 10658 (php-fpm)
   Status: "Ready to handle connections"
   CGroup: /system.slice/php-fpm.service
           ├─10658 php-fpm: master process (/etc/php-fpm.conf)
           ├─10659 php-fpm: pool www
           ├─10660 php-fpm: pool www
           ├─10661 php-fpm: pool www
           ├─10662 php-fpm: pool www
           └─10663 php-fpm: pool www

Sep 24 23:52:32 192.168.1.9 systemd[1]: Starting The PHP FastCGI Process Manager...
Sep 24 23:52:32 192.168.1.9 systemd[1]: Started The PHP FastCGI Process Manager.

#最后重新加载nginx的配置文件
systemctl restart nginx

此时再次访问http://localhost/test.php 就会展示下面的网页

安装kodexplorer

#参考官网https://kodcloud.com/download/的安装说明,下载安装包并解压到合适的目录,这里
cd /home/www/kod
wget https://static.kodcloud.com/update/download/kodbox.1.23.zip
unzip kodbox.1.23.zip && chmod -Rf 777 ./*

#修改nginx的默认web路径,同时指定一下默认首页
vim /etc/nginx/nginx.conf
#root           /usr/share/nginx/html
root            /home/www/kod;
index        index.php index.html

#重新加载配置
nginx -s reload

 这里需要开启MB_STRING和gd扩展

yum install php-mbstring php-gd
vim /etc/php.ini
#在[PHP]节点下新增
extension=php_mbstring.so
extension=/usr/lib64/php/modules/gd.so

#重新启动php-fpm
systemctl stop php-fpm
systemctl start php-fpm

此时刷新http://localhost 会出现kodexplorer登入页面 

结束。

  • 13
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值