Nginx+kodexplorer(可道云部署纪要)
安装nginx
yum install yum-utils
To set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo with the following contents:
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
yum-config-manager --enable nginx-mainline
yum install nginx
systemctl status nginx
systemctl start nginx
systemctl enable nginx
防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
SElinux关闭
临时关闭:
[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
永久关闭:
[root@localhost ~]# vim /etc/sysconfig/selinux
SELINUX=enforcing 改为 SELINUX=disabled
#重启服务reboot
php安装
[root@localhost conf.d]# yum -y install php-fpm php-mbstring php-gd
[root@localhost conf.d]# systemctl status php-fpm
[root@localhost conf.d]# systemctl restart php-fpm
[root@localhost conf.d]# systemctl enable php-fpm
下载kodexplorer
wget http://static.kodcloud.com/update/download/kodexplorer4.39.zip
解压到/data/kodexplorer目录下(自定义目录,本文在/data/kodexplorer)
cd /data/kodexplorer
unzip kodexplorer4.39.zip
nginx配置
server {
listen 80;
server_name localhost;
root /data/kodexplorer/;
index index.html index.htm index.php;
location ~ \.php$ {
root kodexplorer;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /data/kodexplorer$fastcgi_script_name;
include fastcgi_params;
}
}
新增加php配置
vim /etc/php.ini
#在最后一行
extension=mbstring.so
extension=php_gd2.dll
:wq!
#保存退出即可
#重启php-fpm服务
systemctl restart php-fpm
遇到的问题:
1、php的index.html无法访问,SElinux没有关闭导致;
2、是由于php-mbstring php-gd没有安装,并且php.ini没有添加配置(如上<新增加php配置>),图片无法加载‘
3、nginx无法访问到,是由于nginx配置不对,如下修改:
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /data/kodexplorer$fastcgi_script_name;