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;