├── LICENSE ├── README.md ├── bytedance.larkoffice.com.conf ├── default.conf └── www.php8.ltd.conf /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 zu1k 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 据说光下载不回帖的,[color=Red][size=7]一辈子不举[/size][/color] 2 | 3 | github项目链接:https://github.com/linwoodpendleton/nginx_proxy_conf 4 | 之前有人分享过php的,但效率有点低。 5 | 这个是纯NGINX的任意反向代理 6 | 使用访问地址示例: 7 | http://127.0.0.1/HostLocMJJ/https://hostloc.com 8 | 9 | 我做这个的用处就是在某些不方便使用魔法的时候,下载东西,比如github里面的资源。 10 | 随手就是个github镜像站。 11 | 12 | 13 | 14 | 自定义路径 替换HostLocMJJ 为你自己的路径即可 有两处 15 | 16 | 17 | 18 | 2024/09/28 更新 19 | 增加支持Linux 源镜像功能 使用方法如下 20 | 21 | [C6.10-base] 22 | name=CentOS-6.10 - Base 23 | baseurl=http://www.php8.ltd/HostLocMJJ/https://vault.centos.org/6.10/os/$basearch/ 24 | gpgcheck=1 25 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 26 | enabled=1 27 | metadata_expire=never 28 | 29 | [C6.10-updates] 30 | name=CentOS-6.10 - Updates 31 | baseurl=http://www.php8.ltd/HostLocMJJ/https://vault.centos.org/6.10/updates/$basearch/ 32 | gpgcheck=1 33 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 34 | enabled=1 35 | metadata_expire=never 36 | 37 | [C6.10-extras] 38 | name=CentOS-6.10 - Extras 39 | baseurl=http://www.php8.ltd/HostLocMJJ/https://vault.centos.org/6.10/extras/$basearch/ 40 | gpgcheck=1 41 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 42 | enabled=1 43 | metadata_expire=never 44 | 45 | [C6.10-contrib] 46 | name=CentOS-6.10 - Contrib 47 | baseurl=http://www.php8.ltd/HostLocMJJ/https://vault.centos.org/6.10/contrib/$basearch/ 48 | gpgcheck=1 49 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 50 | enabled=0 51 | metadata_expire=never 52 | 53 | [C6.10-centosplus] 54 | name=CentOS-6.10 - CentOSPlus 55 | baseurl=http://www.php8.ltd/HostLocMJJ/https://vault.centos.org/6.10/centosplus/$basearch/ 56 | gpgcheck=1 57 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 58 | enabled=0 59 | metadata_expire=never 60 | 61 | 62 | 63 | 64 | 2024/09/13 更新: 65 | 66 | 67 | 68 | www.php8.ltd.conf 支持docker反代和登陆. 69 | 70 | 71 | 72 | 2024/04/28 更新: 73 | 解决了不能正确跳转(301 302)问题 74 | 75 | 1:24更新: 76 | 77 | 支持反代CF github.com 78 | 79 | 测试: 80 | 81 | https://www.php8.ltd/HostLocMJJ/http://news.baidu.com/(不定时开放) 82 | 83 | https://www.php8.ltd/HostLocMJJ/https://github.com/ElderDrivers/EdXposed (不定时开放) 84 | 85 | 86 | 2023.5.27gju 87 | 支持特殊端口 88 | 89 | 5.4 10:32更新 90 | 91 | 支持中文维基 92 | 93 | 301跟随,有301不会再跳出 94 | 95 | 96 | 97 | 5.4 15:51更新 98 | 99 | 支持自定义路径 替换HostLocMJJ 为你自己的路径即可 有两处 100 | 101 | 修复了一些已知问题 102 | 103 | 104 | 5.4 22:54更新 105 | 106 | 修复301BUG和一些已知问题。 107 | 108 | 109 | 5.5 18:16 更新 110 | 111 | 解决套CF 后还是能获取客户端IP 112 | 113 | 解决因正则导致的500错误 114 | 115 | 116 | 5.5 22:30更新 117 | 118 | 修复git clone 无法使用 119 | 修复一些已知问题 120 | 121 | 5.6 21:46更新 122 | 123 | 修复目标站开启强制gzip 无法替换文本问题 set $unopengzip 0; #对于强制开启压缩的网站开启替换 0 关, 1 开 影响效率 124 | 125 | 126 | 127 | 增加一个伪装站。 修改www.qq.com即可 128 | 129 | 130 | 5.6 23:16更新 131 | 132 | 修复无法获取来源错误 133 | 二次反代改为127.0.0.1了 134 | 135 | 5.7更新 136 | 支持googledrive下载 需要自行导入cookie 137 | 138 | 5.15 增加白名单功能 139 | -------------------------------------------------------------------------------- /bytedance.larkoffice.com.conf: -------------------------------------------------------------------------------- 1 | server 2 | { 3 | listen 80; 4 | #listen [::]:80; 5 | server_name test6.dogsrescue.eu.org ; 6 | index index.html index.htm index.php default.html default.htm default.php; 7 | root /home/wwwroot/test6.dogsrescue.eu.org; 8 | proxy_cache my_cache_static; 9 | return 301 https://$server_name$request_uri; 10 | access_log /home/wwwlogs/www.php8.ltd.log; 11 | } 12 | 13 | server 14 | { 15 | listen 443 ssl http2; 16 | #listen [::]:443 ssl http2; 17 | server_name test6.dogsrescue.eu.org ; 18 | index index.html index.htm index.php default.html default.htm default.php; 19 | root /home/wwwroot/test6.dogsrescue.eu.org; 20 | 21 | ssl_certificate /usr/local/nginx/conf/ssl/test6.dogsrescue.eu.org/fullchain.cer; 22 | ssl_certificate_key /usr/local/nginx/conf/ssl/test6.dogsrescue.eu.org/test6.dogsrescue.eu.org.key; 23 | ssl_session_timeout 5m; 24 | ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; 25 | ssl_prefer_server_ciphers on; 26 | ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5"; 27 | ssl_session_cache builtin:1000 shared:SSL:10m; 28 | # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048 29 | ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem; 30 | 31 | set $custom_PATH /HostLocMJJ; 32 | set $custom_host "pass"; 33 | set $custom_host3 "/"; 34 | set $custom_host5 "/"; 35 | set $unopengzip 0; #对于强制开启压缩的网站开启替换 0 关, 1 开 36 | if ($request_uri ~* ^\/(.+)\/((http|https)://(www.)?([\w-]+(\.)?)+)(.*?)$) { 37 | set $custom_host $2; 38 | set $custom_host3 $7; 39 | } 40 | 41 | 42 | #允许域名 域名白名单 43 | set $banDomain 1; 44 | if ($custom_host = "https://hostloc.com") { 45 | set $banDomain 0; 46 | } 47 | 48 | if ($custom_host = "https://www.baidu.com") { 49 | set $banDomain 0; 50 | } 51 | 52 | if ($custom_host = "https://github.com") { 53 | set $banDomain 0; 54 | } 55 | 56 | 57 | 58 | if ($custom_host ~* "googleusercontent") { 59 | set $banDomain 0; 60 | } 61 | if ($custom_host ~* "larkoffice") { 62 | set $banDomain 0; 63 | } 64 | 65 | if ($custom_host ~* "feishu") { 66 | set $banDomain 0; 67 | } 68 | if ($custom_host ~* "docs.google.com") { 69 | set $banDomain 0; 70 | } 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | set $port ""; 79 | 80 | if ($server_port !~* (443|80)$) { 81 | set $port $server_port; 82 | } 83 | if ($custom_host3 = ""){ 84 | set $custom_host3 "/"; 85 | } 86 | if ($custom_host3 = " "){ 87 | set $custom_host3 "/"; 88 | } 89 | if ($request_uri ~* ^\/(.+)\/((http|https)://(www.)?([\w-]+(\.)?)+)(.+)\?(.+)$) { 90 | set $custom_host3 $7; 91 | } 92 | if ($request_uri ~* ^\/(.+)\/((ht|f)tps?):\/\/([\w\-]+(\.[\w\-]+)*)$) { 93 | return 301 $custom_PATH/$custom_host/; 94 | } 95 | set $custom_host2 "www.baidu.com"; 96 | set $custom_host8 "www.baidu.com"; 97 | if ($custom_host ~* ^((http|https)://)((www.)?([\w-]+(\.)?)+)$) { 98 | set $custom_host8 $3; 99 | set $custom_host2 $3; 100 | set $custom_host5 $1; 101 | } 102 | 103 | set $referer $custom_host; 104 | if ($http_referer ~* ^((http|https)://)(.*?)\/(.+)\/((http|https)://)(.*?)$) { 105 | set $referer $5$7; 106 | } 107 | set $current "http://"; 108 | if ($scheme = https) { 109 | set $current "https://"; 110 | } 111 | set $referer2 ""; 112 | if ($referer ~* ^((http|https)://(www.)?([\w-]+(\.)?)+)(.*?)$) { 113 | set $referer2 $1; 114 | } 115 | set $root_domain ".$myroot_domain"; 116 | set $myroot_domain ".$myroot_domain"; 117 | if ($referer2 ~* (?:\w+\.)*?(\w*\.(.+))[\\\/]*) { 118 | set $root_domain $2; 119 | } 120 | if ($host ~* (?:\w+\.)*?(\w*\.(.+))[\\\/]*) { 121 | set $myroot_domain $2; 122 | } 123 | 124 | if ($root_domain = ".$myroot_domain"){ 125 | set $root_domain "${custom_host2}"; 126 | } 127 | if ($host ~* "(((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?))") { 128 | set $myroot_domain $host; 129 | } 130 | add_header X-Frame-Options $myroot_domain; 131 | proxy_hide_header X-Frame-Options; 132 | proxy_hide_header content-security-policy; 133 | 134 | 135 | # location /redirect/ { 136 | # include enable-php-pathinfo.conf; 137 | 138 | # } 139 | location /HostLocMJJ/ { 140 | if ($banDomain = 1) { 141 | return 404 ; 142 | } 143 | if ($request_method = 'OPTIONS') { 144 | add_header 'Access-Control-Allow-Origin' '*'; 145 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; 146 | 147 | add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; 148 | 149 | add_header 'Access-Control-Max-Age' 1728000; 150 | add_header 'Content-Type' 'text/plain charset=UTF-8'; 151 | add_header 'Content-Length' 0; 152 | return 204; 153 | } 154 | if ($request_method = 'POST') { 155 | add_header 'Access-Control-Allow-Origin' '*'; 156 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; 157 | add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; 158 | } 159 | if ($request_method = 'GET') { 160 | add_header 'Access-Control-Allow-Origin' '*'; 161 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; 162 | add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; 163 | } 164 | proxy_set_header x-forwarded-for ""; 165 | proxy_set_header X-Real-IP ""; 166 | proxy_set_header X-Forwarded-For ""; 167 | proxy_set_header cf-connecting-ip ""; 168 | proxy_set_header True-Client-IP ""; 169 | set $ishttp "http"; 170 | if ($custom_host5 = https://) { 171 | set $ishttp "https"; 172 | } 173 | proxy_ssl_server_name on; 174 | proxy_set_header X-Forwarded-Proto $ishttp; 175 | add_header Proxy-Cache2 $root_domain; 176 | 177 | 178 | if ($unopengzip = 1) { 179 | set $custom_host2 $host; 180 | } 181 | proxy_set_header Host $custom_host2; 182 | proxy_cache_key $host$uri$is_args$args; 183 | proxy_headers_hash_max_size 512; 184 | proxy_pass_header Server; 185 | proxy_headers_hash_bucket_size 128; 186 | proxy_buffer_size 64k; 187 | proxy_buffers 32 64k; 188 | proxy_busy_buffers_size 128k; 189 | 190 | proxy_set_header Cookie $http_cookie; 191 | proxy_cache_methods GET; 192 | proxy_cache_methods POST; 193 | proxy_cache_methods HEAD; 194 | proxy_redirect $upstream_http_location "$current$host:$port$custom_PATH/$upstream_http_location"; 195 | if ($unopengzip = 1) { 196 | set $referer $http_referer; 197 | } 198 | proxy_set_header Referer $referer; 199 | proxy_set_header User-Agent $http_user_agent; 200 | # 防止谷歌返回压缩的内容,因为压缩的内容无法替换字符串 201 | proxy_set_header Accept-Encoding ""; 202 | proxy_connect_timeout 15000; 203 | proxy_send_timeout 15000; 204 | proxy_read_timeout 15000; 205 | proxy_set_header Upgrade $http_upgrade; 206 | proxy_cookie_domain $root_domain $myroot_domain; 207 | proxy_cookie_domain $custom_host8 $myroot_domain; 208 | proxy_cookie_path ~\/(.*) $custom_PATH/$custom_host/$1; 209 | proxy_max_temp_file_size 10m; 210 | proxy_set_header Connection "upgrade"; 211 | proxy_cache_valid 200 304 301 1s; 212 | add_header MJJCDN-Cache "$upstream_cache_status"; 213 | # proxy_temp_file_write_size 512000k; 214 | resolver 1.1.1.1; #改为自己想要的DNS 215 | sub_filter_types text/plain text/javascript text/xml text/css application/x-javascript application/xml application/javascript application/json; 216 | 217 | sub_filter_once off; 218 | proxy_temp_file_write_size 512000k; 219 | sub_filter '".$root_domain' '".$myroot_domain'; 220 | sub_filter '"$root_domain' '"$myroot_domain'; 221 | sub_filter "url(http" "url($current$host:$port$custom_PATH/http"; 222 | set $head '"; 228 | set $html3 "\""; 229 | } 230 | if ($referer ~ "www\.google\.com") { 231 | set $head '"; 240 | sub_filter $html3 "\'"; 241 | sub_filter ""; 195 | set $html3 "\""; 196 | } 197 | if ($referer ~ "www\.google\.com") { 198 | set $head '"; 207 | sub_filter $html3 "\'"; 208 | sub_filter ""; 304 | set $html3 "\""; 305 | } 306 | if ($referer ~ "www\.google\.com" ) { 307 | set $head 308 | '"; 320 | sub_filter $html3 "\'"; 321 | sub_filter "