mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 17:13:56 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,11 @@
|
||||
|
||||
config global
|
||||
option port '8081'
|
||||
option upload_max_filesize '64M'
|
||||
list open_basedir '/'
|
||||
option https '0'
|
||||
option project_directory '/tmp/kodexplorer'
|
||||
option ipv6 '0'
|
||||
option memory_limit '64M'
|
||||
option enable '0'
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2018-2022 Lienol <lawlienol@gmail.com>
|
||||
|
||||
START=99
|
||||
|
||||
CONFIG="kodexplorer"
|
||||
|
||||
TEMP_PATH="/var/etc/$CONFIG"
|
||||
[ -f /etc/nginx/conf.d/luci.locations ] && {
|
||||
NGINX_CONFIG="/etc/nginx/conf.d/$CONFIG.conf"
|
||||
NGINX_TEMPLATE="nginx.server.conf.template"
|
||||
} || {
|
||||
NGINX_CONFIG="$TEMP_PATH/nginx.conf"
|
||||
NGINX_TEMPLATE="nginx.conf.template"
|
||||
}
|
||||
|
||||
PHP_CONFIG="$TEMP_PATH/php.ini"
|
||||
PHP_FPM_CONFIG="$TEMP_PATH/php-fpm.conf"
|
||||
PHP_FPM_SOCK="$TEMP_PATH/php-fpm.sock"
|
||||
|
||||
config_t_get() {
|
||||
local index=0
|
||||
[ -n "$4" ] && index=$4
|
||||
local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
gen_nginx_config() {
|
||||
ipv6=$(config_t_get global ipv6 0)
|
||||
port=$(config_t_get global port)
|
||||
[ "$(config_t_get global https 0)" == "1" ] && {
|
||||
port="$port ssl"
|
||||
ssl_certificate="ssl_certificate $(config_t_get global certificate);"
|
||||
ssl_certificate_key="ssl_certificate_key $(config_t_get global key);"
|
||||
}
|
||||
sed -e "s#|PID|#$TEMP_PATH/nginx.pid#g" \
|
||||
-e "s#|PORT|#$port#g" \
|
||||
-e "s#|ssl_certificate|#$ssl_certificate#g" \
|
||||
-e "s#|ssl_certificate_key|#$ssl_certificate_key#g" \
|
||||
-e "s#|project_directory|#$project_directory#g" \
|
||||
-e "s#|SOCK|#$PHP_FPM_SOCK#g" \
|
||||
-e "s#|upload_max_filesize|#$upload_max_filesize#g" \
|
||||
-e "s#|temp_path|#$TEMP_PATH/temp#g" \
|
||||
/etc/$CONFIG/$NGINX_TEMPLATE > $1
|
||||
|
||||
[ "$ipv6" = "0" ] && sed -i '/listen \[::\]:/d' $1
|
||||
}
|
||||
|
||||
gen_php_config() {
|
||||
sed -e "s#|project_directory|#$project_directory#g" \
|
||||
-e "s#|open_basedir|#$open_basedir#g" \
|
||||
-e "s#|memory_limit|#$memory_limit#g" \
|
||||
-e "s#|upload_max_filesize|#$upload_max_filesize#g" \
|
||||
/etc/$CONFIG/php.ini.template > $PHP_CONFIG
|
||||
|
||||
sed -e "s#|PID|#$TEMP_PATH/php-fpm.pid#g" \
|
||||
-e "s#|ERROR_LOG|#$TEMP_PATH/php-fpm.log#g" \
|
||||
-e "s#|SOCK|#$PHP_FPM_SOCK#g" \
|
||||
/etc/$CONFIG/php-fpm.conf.template > $PHP_FPM_CONFIG
|
||||
}
|
||||
|
||||
start() {
|
||||
ENABLED=$(config_t_get global enable 0)
|
||||
[ "$ENABLED" = "0" ] && return 0
|
||||
mkdir -p $TEMP_PATH $TEMP_PATH/temp /var/log/nginx /var/lib/nginx
|
||||
memory_limit=$(config_t_get global memory_limit 64M)
|
||||
upload_max_filesize=$(config_t_get global upload_max_filesize 64M)
|
||||
project_directory=$(config_t_get global project_directory)
|
||||
open_basedir=$(config_t_get global open_basedir "/")
|
||||
open_basedir=$(echo $open_basedir | sed "s/ /:/g")
|
||||
gen_php_config
|
||||
/usr/bin/php8-fpm -c $PHP_CONFIG -R -y $PHP_FPM_CONFIG
|
||||
gen_nginx_config $NGINX_CONFIG
|
||||
[ -f /etc/nginx/conf.d/luci.locations ] && /etc/init.d/nginx reload || /usr/sbin/nginx -c $NGINX_CONFIG >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
stop() {
|
||||
[ -f /etc/nginx/conf.d/luci.locations ] && (rm -f $NGINX_CONFIG; /etc/init.d/nginx reload) || /usr/sbin/nginx -c $NGINX_CONFIG -s stop >/dev/null 2>&1
|
||||
[ -f "$TEMP_PATH/php-fpm.pid" ] && kill -2 $(cat $TEMP_PATH/php-fpm.pid) >/dev/null 2>&1
|
||||
rm -rf $TEMP_PATH $NGINX_CONFIG
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
user root root;
|
||||
worker_processes auto;
|
||||
pid |PID|;
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
server {
|
||||
listen |PORT|;
|
||||
listen [::]:|PORT|;
|
||||
|ssl_certificate|
|
||||
|ssl_certificate_key|
|
||||
ssl_session_cache shared:SSL:1m;
|
||||
ssl_session_timeout 5m;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
ssl_prefer_server_ciphers on;
|
||||
server_name localhost;
|
||||
root |project_directory|;
|
||||
index index.html index.htm index.php;
|
||||
location ~ \.php(.*)$ {
|
||||
fastcgi_pass unix:|SOCK|; # 通过 Unix 套接字执行 PHP
|
||||
fastcgi_index index.php;
|
||||
fastcgi_split_path_info ^(.+\.php)(.*)$;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # 修复 Nginx fastcgi 漏洞
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
client_max_body_size |upload_max_filesize|;
|
||||
client_body_temp_path |temp_path|;
|
||||
client_body_timeout 3600s;
|
||||
fastcgi_connect_timeout 3600s;
|
||||
fastcgi_send_timeout 3600s;
|
||||
fastcgi_read_timeout 3600s;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
server {
|
||||
listen |PORT|;
|
||||
listen [::]:|PORT|;
|
||||
|ssl_certificate|
|
||||
|ssl_certificate_key|
|
||||
ssl_session_timeout 5m;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
ssl_prefer_server_ciphers on;
|
||||
server_name localhost;
|
||||
root |project_directory|;
|
||||
index index.html index.htm index.php;
|
||||
location ~ \.php(.*)$ {
|
||||
fastcgi_pass unix:|SOCK|; # 通过 Unix 套接字执行 PHP
|
||||
fastcgi_index index.php;
|
||||
fastcgi_split_path_info ^(.+\.php)(.*)$;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # 修复 Nginx fastcgi 漏洞
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
client_max_body_size |upload_max_filesize|;
|
||||
client_body_timeout 3600s;
|
||||
fastcgi_connect_timeout 3600s;
|
||||
fastcgi_send_timeout 3600s;
|
||||
fastcgi_read_timeout 3600s;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
[global]
|
||||
pid = |PID|
|
||||
error_log = |ERROR_LOG|
|
||||
[www]
|
||||
user = root
|
||||
listen = |SOCK|
|
||||
listen.mode = 0666
|
||||
listen.allowed_clients = 127.0.0.1
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
chdir = /
|
||||
@@ -0,0 +1,55 @@
|
||||
[PHP]
|
||||
zend.ze1_compatibility_mode = Off
|
||||
engine = On
|
||||
precision = 12
|
||||
y2k_compliance = On
|
||||
output_buffering = Off
|
||||
zlib.output_compression = Off
|
||||
implicit_flush = Off
|
||||
unserialize_callback_func =
|
||||
serialize_precision = 100
|
||||
|
||||
open_basedir = /tmp:|project_directory|:|open_basedir|:/usr/bin/
|
||||
disable_functions =
|
||||
disable_classes =
|
||||
expose_php = On
|
||||
max_execution_time = 3600
|
||||
max_input_time = 3600
|
||||
memory_limit = |memory_limit|
|
||||
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
|
||||
|
||||
display_errors = On
|
||||
display_startup_errors = Off
|
||||
log_errors = Off
|
||||
ignore_repeated_errors = Off
|
||||
ignore_repeated_source = Off
|
||||
report_memleaks = On
|
||||
track_errors = Off
|
||||
|
||||
variables_order = "EGPCS"
|
||||
request_order = "GP"
|
||||
register_globals = Off
|
||||
register_long_arrays = Off
|
||||
register_argc_argv = On
|
||||
auto_globals_jit = On
|
||||
post_max_size = |upload_max_filesize|
|
||||
magic_quotes_runtime = Off
|
||||
magic_quotes_sybase = Off
|
||||
auto_prepend_file =
|
||||
auto_append_file =
|
||||
default_mimetype = "text/html"
|
||||
|
||||
;doc_root = "/www"
|
||||
user_dir =
|
||||
extension_dir = "/usr/lib/php8"
|
||||
enable_dl = On
|
||||
cgi.fix_pathinfo=1
|
||||
|
||||
file_uploads = On
|
||||
upload_tmp_dir = "/tmp"
|
||||
upload_max_filesize = |upload_max_filesize|
|
||||
max_file_uploads = 1000
|
||||
|
||||
allow_url_fopen = On
|
||||
allow_url_include = Off
|
||||
default_socket_timeout = 60
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
[ ! -f "/usr/share/ucitrack/luci-app-kodexplorer.json" ] && {
|
||||
cat > /usr/share/ucitrack/luci-app-kodexplorer.json << EEOF
|
||||
{
|
||||
"config": "kodexplorer",
|
||||
"init": "kodexplorer"
|
||||
}
|
||||
EEOF
|
||||
}
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@kodexplorer[-1]
|
||||
add ucitrack kodexplorer
|
||||
set ucitrack.@kodexplorer[-1].init=kodexplorer
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
/etc/init.d/php8-fpm stop
|
||||
/etc/init.d/php8-fpm disable
|
||||
rm -rf /tmp/luci-*cache
|
||||
exit 0
|
||||
Reference in new issue
Block a user