部署仓库初始化:epay 部署配置、补丁与插件
- docker-compose.prod.yml:挂载 epay-ui.css/js/head.php 补丁到 staging(镜像升级不丢) - docker/nginx.conf:补丁静态资源 no-cache,改版立即生效 - patches/: - test.php 修复 paytype JSON 对象导致测试支付页空白 - epay-ui.css 后台全屏/侧栏加宽/导航两列布局覆盖 - epay-ui.js 去除页面容器宽度限制 + 侧栏当前菜单自动滚动 - head.php 资源 ?v= 版本号强制回源 - functions.php is_public_url 白名单等既有补丁 - plugins/ 支付插件源码 - .gitignore 排除 .env 等敏感与临时文件
This commit is contained in:
commit
b7613ba082
176 files changed
+47057
No files matched your search
@@ -0,0 +1,127 @@
|
||||
# ============================================
|
||||
# 彩虹易支付 Nginx 配置
|
||||
# ============================================
|
||||
|
||||
upstream php-upstream {
|
||||
server php:9000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /var/www/html;
|
||||
index index.php index.html;
|
||||
|
||||
charset utf-8;
|
||||
client_max_body_size 50m;
|
||||
|
||||
# 反代环境下使用相对跳转,避免 301 到 http://
|
||||
absolute_redirect off;
|
||||
|
||||
# ==========================================
|
||||
# 信任宝塔 Nginx 反向代理传递的真实 IP
|
||||
# ==========================================
|
||||
set_real_ip_from 127.0.0.1;
|
||||
set_real_ip_from 172.16.0.0/12;
|
||||
set_real_ip_from 192.168.0.0/16;
|
||||
real_ip_header X-Forwarded-For;
|
||||
real_ip_recursive on;
|
||||
|
||||
# ==========================================
|
||||
# 安全响应头
|
||||
# ==========================================
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
|
||||
|
||||
# ==========================================
|
||||
# 安全规则:禁止直接访问核心目录
|
||||
# ==========================================
|
||||
location ^~ /includes {
|
||||
deny all;
|
||||
return 403;
|
||||
}
|
||||
|
||||
location ^~ /plugins {
|
||||
deny all;
|
||||
return 403;
|
||||
}
|
||||
|
||||
# install/index.php 在 install.lock 存在时自行拒绝重装;安装 SQL/锁文件不可下载。
|
||||
location ~* ^/install/.*\.(sql|lock)$ {
|
||||
deny all;
|
||||
return 403;
|
||||
}
|
||||
|
||||
# 保护敏感文件
|
||||
location ~* /(config\.php|\.htaccess|\.git) {
|
||||
deny all;
|
||||
return 403;
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# URL 重写规则(对应 nginx.txt)
|
||||
# ==========================================
|
||||
location / {
|
||||
# *.html → index.php?mod=xxx
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^/(.[a-zA-Z0-9\-\_]+).html$ /index.php?mod=$1 last;
|
||||
}
|
||||
# /pay/xxx → pay.php?s=xxx
|
||||
rewrite ^/pay/(.*)$ /pay.php?s=$1 last;
|
||||
# /api/xxx → api.php?s=xxx
|
||||
rewrite ^/api/(.*)$ /api.php?s=$1 last;
|
||||
# /doc/xxx.html → index.php?doc=xxx
|
||||
rewrite ^/doc/(.[a-zA-Z0-9\-\_]+).html$ /index.php?doc=$1 last;
|
||||
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# PHP 处理
|
||||
# ==========================================
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass php-upstream;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
|
||||
# 安全:防止上传文件被执行
|
||||
fastcgi_param PHP_VALUE "open_basedir=/var/www/html:/tmp/:/var/lib/php/sessions/";
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# 静态资源缓存
|
||||
# ==========================================
|
||||
# 前端补丁文件(后台布局 CSS/JS):始终回源校验,改版立即生效
|
||||
location = /assets/dist/epay-ui.css {
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Cache-Control "no-cache" always;
|
||||
}
|
||||
location = /assets/dist/epay-ui.js {
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Cache-Control "no-cache" always;
|
||||
}
|
||||
|
||||
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# 上传目录:禁止执行 PHP
|
||||
# ==========================================
|
||||
location /assets/uploads/ {
|
||||
location ~* \.php$ {
|
||||
deny all;
|
||||
return 403;
|
||||
}
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# 日志
|
||||
# ==========================================
|
||||
access_log /var/log/nginx/epay-access.log;
|
||||
error_log /var/log/nginx/epay-error.log;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
; ============================================
|
||||
; 彩虹易支付 PHP 自定义配置
|
||||
; ============================================
|
||||
|
||||
; 时区
|
||||
date.timezone = Asia/Shanghai
|
||||
|
||||
; 错误报告(生产环境关闭详细错误)
|
||||
error_reporting = E_ERROR | E_PARSE | E_COMPILE_ERROR
|
||||
display_errors = Off
|
||||
display_startup_errors = Off
|
||||
|
||||
; 性能
|
||||
max_execution_time = 300
|
||||
max_input_time = 300
|
||||
memory_limit = 256M
|
||||
|
||||
; 上传
|
||||
upload_max_filesize = 50M
|
||||
post_max_size = 50M
|
||||
file_uploads = On
|
||||
|
||||
; Session
|
||||
session.save_handler = files
|
||||
session.save_path = "/var/lib/php/sessions"
|
||||
session.gc_maxlifetime = 1440
|
||||
session.cookie_httponly = On
|
||||
; 生产环境部署在 HTTPS 下时建议改为 On
|
||||
session.cookie_secure = Off
|
||||
session.cookie_samesite = "Strict"
|
||||
session.use_strict_mode = 1
|
||||
session.use_only_cookies = 1
|
||||
|
||||
; 安全
|
||||
expose_php = Off
|
||||
allow_url_fopen = Off
|
||||
allow_url_include = Off
|
||||
disable_functions = exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source,pcntl_exec
|
||||
enable_dl = Off
|
||||
|
||||
; cURL
|
||||
curl.cainfo = /etc/ssl/certs/ca-certificates.crt
|
||||
|
||||
; OpCache
|
||||
opcache.enable = 1
|
||||
opcache.memory_consumption = 128
|
||||
opcache.interned_strings_buffer = 8
|
||||
opcache.max_accelerated_files = 10000
|
||||
opcache.revalidate_freq = 2
|
||||
opcache.fast_shutdown = 1
|
||||
Reference in new issue
Block a user