先安裝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.
請參考:https://blog.csdn.net/wang805447391/article/details/77481018
之後重新打開瀏覽器試一下,應該能出來以下界面:
寫在最後:爲了自己傳文件方便,我開啓了php7-fpm的root權限,如果您自己覺得不適合,請自行修改相應配置文件。
建議不要用root!
建議不要用root!
建議不要用root!
補充:
kodexplorer上傳文件時,處於某些情況考慮,會在/kod安裝目錄/data/User/用戶名/data/temp中生成大量的臨時文件,一個409.6k,如果是flash或者mmc,建議把該目錄ln -s 到其他位置,例如zram中、外置硬盤中,等等。