恭喜, 站点创建成功!
这是默认index.html,本页面由系统自动生成
- 本页面在FTP根目录下的index.html
- 您可以修改、删除或覆盖本页面
- FTP相关信息,请到“面板系统后台 > FTP” 查看
不维护了,nginx config和auth_proxy html如下
server {
listen 80;
listen 443 ssl;
server_name lib1.itshenryz.com;
root /www/wwwroot/lib1.itshenryz.com;
ssl_certificate /www/server/panel/vhost/cert/lib1.itshenryz.com/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/lib1.itshenryz.com/privkey.pem;
error_page 502 /502.html;
location /502.html{
}
# 判断 cookie 中的密码是否正确,如果密码不正确跳转到 login.html
location ^~ / {
if ($auth_status = "invalid") {
return 302 /auth_proxy.html; # 如果密码不正确,跳转到 login 页面
}
proxy_pass http://localhost:38080/;
proxy_set_header Host zh.bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Accept-Encoding "";
proxy_set_header Accept-Language "zh-CN";
sub_filter 'zh.bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion' 'lib1.itshenryz.com';
sub_filter 'loginzlib2vrak5zzpcocc3ouizykn6k5qecgj2tzlnab5wcbqhembyd.onion' 'lib1.itshenryz.com/login';
sub_filter 'z-library.rs' 'lib1.itshenryz.com';
sub_filter 'dln1.fcdn.sk' 'fcdn-proxy.itshenryz.com';
sub_filter_once off;
proxy_ssl_server_name on;
proxy_http_version 1.1;
# proxy_hide_header Upgrade;
header_filter_by_lua '
local cookies = ngx.header.set_cookie
if not cookies then return end
if type(cookies) ~= "table" then cookies = {cookies} end
local newcookies = {}
for i, val in ipairs(cookies) do
local newval = string.gsub(val, "([dD]omain)=[%w_-\\\\.]+",
"%1=lib1.itshenryz.com")
table.insert(newcookies, newval)
end
ngx.header.set_cookie = newcookies
-- 替换 Location 头
local location = ngx.header.location
if location then
location = string.gsub(location, "zh.bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion", "lib1.itshenryz.com")
location = string.gsub(location, "dln1.fcdn.sk", "fcdn-proxy.itshenryz.com")
ngx.header.location = location
end
';
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
set $static_fileyEkQP6nE 0;
if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
{
set $static_fileyEkQP6nE 1;
expires 1m;
}
if ( $static_fileyEkQP6nE = 0 )
{
add_header Cache-Control no-cache;
}
}
location ^~ /login {
if ($auth_status = "invalid") {
return 302 /auth_proxy.html; # 如果密码不正确,跳转到 login 页面
}
proxy_pass http://localhost:38080/;
proxy_set_header Host zh.loginzlib2vrak5zzpcocc3ouizykn6k5qecgj2tzlnab5wcbqhembyd.onion;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Accept-Encoding "";
proxy_set_header Accept-Language "zh-CN,zh";
sub_filter 'zh.bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion' 'lib1.itshenryz.com';
sub_filter_once off;
proxy_ssl_server_name on;
proxy_http_version 1.1;
# proxy_hide_header Upgrade;
header_filter_by_lua '
local cookies = ngx.header.set_cookie
if not cookies then return end
if type(cookies) ~= "table" then cookies = {cookies} end
local newcookies = {}
for i, val in ipairs(cookies) do
local newval = string.gsub(val, "([dD]omain)=[%w_-\\\\.]+",
"%1=lib1.itshenryz.com")
table.insert(newcookies, newval)
end
ngx.header.set_cookie = newcookies
-- 替换 Location 头
local location = ngx.header.location
if location then
ngx.header.location = string.gsub(location, "zh.bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion", "lib1.itshenryz.com")
end
';
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
set $static_fileyEkQP6nE 0;
if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
{
set $static_fileyEkQP6nE 1;
expires 1m;
}
if ( $static_fileyEkQP6nE = 0 )
{
add_header Cache-Control no-cache;
}
}
location /check_status {
proxy_pass http://localhost:38080/;
proxy_set_header Host zh.bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Accept-Encoding "";
proxy_set_header Accept-Language "zh-CN";
if ($http_user_agent != "Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/)"){
return 403;
}
}
# 登录页面处理
location /auth_proxy.html {
try_files $uri $uri/ =404;
}
# 处理登录请求,将密码存入 cookie
location /auth_proxy {
set $auth_proxy_password $arg_password; # 获取用户输入的密码
# 设置 cookie
add_header Set-Cookie "auth_proxy_password=$auth_proxy_password; Path=/; HttpOnly";
return 302 /;
}
access_log /www/wwwlogs/lib1.itshenryz.com.log;
error_log /www/wwwlogs/lib1.itshenryz.com.error.log;
#Monitor-Config-Start 网站监控报表日志发送配置
access_log syslog:server=unix:/tmp/bt-monitor.sock,nohostname,tag=25__access monitor;
error_log syslog:server=unix:/tmp/bt-monitor.sock,nohostname,tag=25__error;
#Monitor-Config-End
}
登录
登录