先安装php7
opkg find php7* | cut -d " " -f 1 | xargs opkg install
编辑/etc/php7-fpm.d/www.conf文件,把user改为root
listen写个端口号,我这里用了1027,因为php7-fcgi用了1026,两个连一起,好记!!!
编辑/etc/init.d/php7-fpm文件,service_start $PROG -R -y $CONFIG -g $SERVICE_PID_FILE,加上那个-R,代表运行以root运行。
再安装nginx
配置/etc/nginx/nginx.conf
user root root;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include conf/kodexplorer.conf;
include mime.types;
#default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
}
配置/etc/nginx/conf/kodexplorer.conf
server {
listen 888;
#server_name www.example.com;
#access_log logs/example.access.log main;
server_name_in_redirect off;
root /web/kod;
index index.php index.html index.htm;
# WordPress single blog rules.
# Designed to be included in any server {} block.
# This order might seem weird - this is attempted to match last if rules below fail.
# http://wiki.nginx.org/HttpCoreModule
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Directives to send expires headers and turn off 404 error logging.
#location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
# access_log off; log_not_found off; expires max;
#}
# Uncomment one of the lines below for the appropriate caching plugin (if used).
#include global/wordpress-wp-super-cache.conf;
#include global/wordpress-w3-total-cache.conf;
# Pass all .php files onto a php-fpm/php-fcgi server.
location ~ \.php$ {
# Zero-day exploit defense.
# http://forum.nginx.org/read.php?2,88845,page=3
# Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/php-fcgi.
# Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine. And then cross your fingers that you won't get hacked.
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:1027;
}
}
重启php7-fpm和nginx
去https://gitee.com/kalcaddle/KODExplorer下载最新版的kodexplorer
放在/web/kod里面,打开浏览器试试。
此时,应该显示No input file specified.
之后重新打开浏览器试一下,应该能出来以下界面:
写在最后:为了自己传文件方便,我开启了php7-fpm的root权限,如果您自己觉得不适合,请自行修改相应配置文件。
建议不要用root!
建议不要用root!
建议不要用root!
补充:
kodexplorer上传文件时,处于某些情况考虑,会在/kod安装目录/data/User/用户名/data/temp中生成大量的临时文件,一个409.6k,如果是flash或者mmc,建议把该目录ln -s 到其他位置,例如zram中、外置硬盘中,等等。