Nginx + Kodex Explorer

Nginx + Kodex Explorer

Install 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

firewall

systemctl stop firewalld.service
systemctl disable firewalld.service

SElinux off

Temporarily Closed:

[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive

Permanent closure:

[root@localhost ~]# vim /etc/sysconfig/selinux
SELINUX=enforcing Change to SELINUX=disabled
#Restart service reboot

php installation

[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

Download Kodex Explorer

wget http://static.kodcloud.com/update/download/kodexplorer4.39.zip

Extract it to the directory of / data/kodexplorer (custom directory, this article is in / data/kodexplorer)

cd /data/kodexplorer
unzip kodexplorer4.39.zip

nginx configuration

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;
        }
 }

New php configuration

vim /etc/php.ini
#On the last line
extension=mbstring.so
extension=php_gd2.dll
:wq!
#Save to exit
#Restart PHP FPM service
systemctl restart php-fpm

Problems encountered:

1. The index.html of php cannot be accessed, and SElinux is not closed;

2. Because PHP mbstring PHP GD is not installed and php.ini does not add configuration (as above < New PHP configuration >), the picture cannot be loaded‘

3. Nginx cannot be accessed because of the incorrect configuration of nginx, which is modified as follows:

#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /data/kodexplorer$fastcgi_script_name;

Tags: Web Server PHP Nginx yum SELinux

Posted on Mon, 02 Dec 2019 12:18:27 -0800 by Jamez