# mirror-redirect **Repository Path**: sdk-apis/mirror-redirect ## Basic Information - **Project Name**: mirror-redirect - **Description**: 镜像、跳转、反向代理 - **Primary Language**: PHP - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-02-04 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # mirror-redirect #### 介绍 镜像、跳转、反向代理 #### 软件架构 软件架构说明 依赖文件 fileinfo 通用扩展 用于获取文件MIME,编码等信息! 因为 reverse-proxy.php 用到了文件类型检测 #### 安装教程 mirror-redirect nginx 的 伪静态 ``` location /tx { if (!-e $request_filename){ rewrite ^(.*)$ /mirror-redirect/server.php?s=$1 last; break; } } location /re { if (!-e $request_filename){ rewrite ^(.*)$ /mirror-redirect/redirect302.php?s=$1 last; break; } } location /px { if (!-e $request_filename){ rewrite ^(.*)$ /mirror-redirect/reverse-proxy.php?s=$1 last; break; } } ``` 同时要求nginx 的 conf设置不要冲突,例如宝塔默认有对图片js、css之类的文件进行设置,需要删除. 以宝塔nginx为例,请删除以下几行默认的配置 ``` location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; error_log off; access_log off; } location ~ .*\.(js|css)?$ { expires 12h; error_log off; access_log off; } ``` ## 测试 http://mirror.si7.gitbay.net/px/https://www.google.com.hk/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png 对于被屏蔽的google,需要使用https 才能正确访问。 https://mirror.si7.gitbay.net/px/https://www.google.com.hk/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png https://mirror.si7.gitbay.net/px/https://www.baidu.com/img/baidu_jgylogo3.gif http://mirror.si7.gitbay.net/px/https://www.baidu.com/img/baidu_jgylogo3.gif http://mirror.si7.gitbay.net/px/https://gitee.com/index/gitee-people/images/web_aresn_banner.jpg http://mirror.si7.gitbay.net/px/https://vm.gtimg.cn/tencentvideo/txp/js/txplayer.js http://mirror.si7.gitbay.net/px/https://vm.gtimg.cn/tencentvideo/txp/js/txplayer.js http://mirror.si7.gitbay.net/px/https://vm.gtimg.cn/c/=/tencentvideo/txp/style/txp_barrage.css?_=1548918296252 https://mirror.si7.gitbay.net/re/https://www.baidu.com/img/baidu_jgylogo3.gif http://tajiyu.com/px/https://www.baidu.com/img/baidu_jgylogo3.gif http://tajiyu.com/px/https://gitee.com/index/gitee-people/images/web_aresn_banner.jpg http://tajiyu.com/px/https://vm.gtimg.cn/tencentvideo/txp/js/txplayer.js http://tajiyu.com/px/https://vm.gtimg.cn/tencentvideo/txp/js/txplayer.js http://tajiyu.com/px/https://vm.gtimg.cn/c/=/tencentvideo/txp/style/txp_barrage.css?_=1548918296252 http://tajiyu.com/re/https://gitee.com/index/gitee-people/images/web_aresn_banner.jpg