feat: 网站增加创建反向代理功能

This commit is contained in:
zhengkunwang223
2023-04-24 17:53:05 +08:00
committed by zhengkunwang223
parent bd8d96be4d
commit d900b52a50
26 changed files with 790 additions and 89 deletions
+12
View File
@@ -0,0 +1,12 @@
proxy_temp_path /www/common/proxy/proxy_temp_dir;
proxy_cache_path /www/common/proxy/proxy_cache_dir levels=1:2 keys_zone=proxy_cache_panel:20m inactive=1d max_size=5g;
client_body_buffer_size 512k;
proxy_connect_timeout 60;
proxy_read_timeout 60;
proxy_send_timeout 60;
proxy_buffer_size 32k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_cache proxy_cache_panel;
+9
View File
@@ -19,3 +19,12 @@ var IndexPHP []byte
//go:embed rewrite/*
var Rewrites embed.FS
//go:embed cache.conf
var Cache []byte
//go:embed proxy.conf
var Proxy []byte
//go:embed proxy_cache.conf
var ProxyCache []byte
+12
View File
@@ -0,0 +1,12 @@
location ^~ /test {
proxy_pass http://1panel.cloud/;
proxy_set_header Host $host;
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 "upgrade";
proxy_http_version 1.1;
add_header X-Cache $upstream_cache_status;
}
+4
View File
@@ -0,0 +1,4 @@
proxy_ignore_headers Set-Cookie Cache-Control expires;
proxy_cache cache_one;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid 200 304 301 302 10m;
+10
View File
@@ -0,0 +1,10 @@
set $static_fileg 0;
if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
{
set $static_fileg 1;
expires 1m;
}
if ( $static_fileg = 0 )
{
add_header Cache-Control no-cache;
}