map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server
{
listen 80 default_server;
listen 443 ssl http2 default_server;
listen [::]:80 default_server;
listen [::]:443 ssl http2 default_server;
server_name hiwepy.eicp.vip;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/rancher-proxy;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
ssl_certificate /www/server/panel/vhost/cert/hiwepy.eicp.vip/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/hiwepy.eicp.vip/privkey.pem;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
error_page 497 https://$host$request_uri;
#SSL-END
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
#error_page 404 /404.html;
#error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START PHP引用配置,可以注释或修改
include enable-php-00.conf;
#PHP-INFO-END
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
#include /www/server/panel/vhost/rewrite/hiwepy.eicp.vip.conf;
#REWRITE-END
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
#proxy_connect_timeout 30; #Nginx服务器与被代理的服务器建立连接的超时时间 默认60秒
#proxy_read_timeout 10; #Nginx服务器被想被代理服务器组发出read请求后,等待响应的超时时间,默认60秒
#proxy_send_timeout 30; #Nginx服务器想被代理服务器组发出write请求后,等待响应的超时时间,默认60秒
#proxy_ignore_client_abort off; # 客户端断网时,Nginx服务器是否终结对代理服务器的请求,默认off
location ~ ^/v3/subscribe|^/v3/clusters|^/v3/cluster {
proxy_connect_timeout 60s;
proxy_read_timeout 360s;
proxy_send_timeout 600s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://192.168.1.130;
# 配置参数(重要)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location ~ ^/k8s/clusters {
proxy_connect_timeout 60s;
proxy_read_timeout 360s;
proxy_send_timeout 600s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://192.168.1.130;
# 配置参数(重要)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location ~ ^/v3/projects {
proxy_connect_timeout 60s;
proxy_read_timeout 360s;
proxy_send_timeout 600s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://192.168.1.130;
# 配置参数(重要)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location ~ / {
# 没有配置OPTIONS的话,浏览器如果是自动识别协议(http or https),那么浏览器的自动OPTIONS请求会返回不能跨域
if ($request_method = OPTIONS ) { return 200;
}
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 X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port $server_port;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600; #rewrite ^/api/(.*)$ /$1 break;
#rewrite ^(.*)$ https://192.168.1.130 permanent;
#proxy_pass http://gateways;
#rewrite ^(.*) https://$server_name$1 permanent;
proxy_pass https://192.168.1.130;
proxy_redirect off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log off;
access_log /dev/null;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log off;
access_log /dev/null;
}
access_log /www/wwwlogs/hiwepy.eicp.vip.log;
error_log /www/wwwlogs/hiwepy.eicp.vip.error.log;
}
作者:Jeebiz 创建时间:2020-03-09 23:10
更新时间:2023-03-28 22:49
更新时间:2023-03-28 22:49