Photogallery X3 Nginx 伪静态

leon.zhou 2025-11-06 X3 Photo Gallery 17

安装

最新版是 3.30.1,官网下载链接
安装环境:PHP 5.3 或更高,需要PHP扩展 GD 和 Mcrypt
安装过程接不多说了,参考官方详细文档
需要注意的的伪静态设置是,如果原来配置文档有涉及 js,css 的设置建议先删除。(宝塔需要删除原来配置文档里面 location ~js jpg 部分)

Nginx 伪静态


location / {
   if (!-e $request_filename){
     # Rewrite any calls to html|json|xml|atom|rss if a folder matching * exists
     rewrite (.+)\.(html|json|xml|atom|rss)$ $1/ last;
     # Rewrite any calls to /render to the X3 image resizer
     rewrite ^/render/. /app/parsers/slir/ last;
     # Rewrite routes to X3 application index.php if they are non-existent files/dirs
     rewrite ^(.*)$ /index.php?$1 last;
   }
 }
 # Prevent web access to X3 /config and /_cache directories
 location ~ /(config|_cache) {
   deny all;
 }


授权

以这个版本为例,把验证网址 https://auth.photo.gallery/ 改成 /auth,再在 /auth 目录下放入自己的授权文件

  • 修改 /app/public/js/3.30.1/x3.min.js

    搜索 aHR0cHM6Ly9hdXRoLg== 替换为 Lw==
    搜索 cGhvdG8uZ2FsbGVyeQ== 替换为 YXV0aA==

    代码为 base64 加密,解密后对应

    aHR0cHM6Ly9hdXRoLg== -> https://auth
    cGhvdG8uZ2FsbGVyeQ== -> photo.gallery
    Lw== -> /
    YXV0aA== -> auth
  • 修改 /panel/filemanager_js/x3_panel.js

    搜索 aHR0cHM6Ly9hdXRoLnBob3RvLmdhbGxlcnkv 替换为 L2F1dGgv

    代码为 base64 加密,解密后对应

    aHR0cHM6Ly9hdXRoLnBob3RvLmdhbGxlcnkv -> https://auth.photo.gallery/
    L2F1dGgv -> /auth/
  • 修改使用本地 x3.min.js

    修改引用文件

    修改 /app/templates/cc/29/202264ab201d0d43a63882c31b1c06ae7e7992a5c371c52f885633d0acfa.php
    大概第71行

    $context["core_js"] = (("https://cdn.jsdelivr.net/npm/x3.photo.gallery@" . $this->getAttribute((isset($context["page"]) ? $context["page"] : null), "x3_version")) . "/js/x3.min.js");      
    修改为:
    $context["core_js"] = ("/app/public/js/3.30.1/x3.min.js");

    或者从后台设置取消 cdn,全部使用本地静态:设置 -> 高级 -> CDN,取消勾选

  • 新建验证文件 /auth/index.php

    简单模式

    <?php 
    header('Access-Control-Allow-Origin: *');
    header('content-type:application/json');
    echo '{"status":200,"message":"License is valid.","parameters":{"type":"1"}}';
    ?>

    指定域名

    <? php 
    header('Access-Control-Allow-Origin: *');
    header('content-type:application/json');
    $allowed_hosts = array('pg.yuwei.cc', 'p2.btu.pp.ua');
    if (in_array($_SERVER['SERVER_NAME'], $allowed_hosts)) {
       echo '{"status":200,"message":"License is valid [btu.pp.ua]","parameters":{"type":"1"}}';
    }else{
       echo '{"status":301,"message":"License not Found"}';
    }
    ?>

    这样应该可以了
    好像 POST 授权网址后,只要 status 返回的代码不是 301,它就不会判断是不是正版,不再进行下一步的弹窗和跳转了
    目前个人使用遇到最大问题
    文件夹不支持 #$%^&*()+=[]’”/|{} `~!@.

文章作者: 君玉自牧

文章链接: https://yuwei.cc/posts/photogallery-x3.html

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 君玉自牧!

Photogallery

猜你喜欢

发表评论

发表评论:

复制成功

手机扫一扫添加微信
扫描二维码
知道了
扫描微信 356966566