map $http_upgrade $connection_upgrade {
        default upgrade;
        ''  close;
    }
server
{
    listen 80 default_server;
    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;
    listen [::]:80 default_server;
    server_name jeebiz.picp.vip;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/proxmox-proxy;

    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    ssl_certificate    /www/server/panel/vhost/cert/jeebiz.picp.vip/fullchain.pem;
    ssl_certificate_key    /www/server/panel/vhost/cert/jeebiz.picp.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/jeebiz.picp.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 on ; # 客户端断网时,Nginx服务器是否终结对代理服务器的请求,默认off

     location ~ ^/api2 {                 

        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.230:8006;
        # 配置参数(重要) 
        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 ) {
            add_header Access-Control-Allow-Origin "$http_origin";
            add_header Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, DELETE";
            add_header Access-Control-Max-Age "3600";
            add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization";
            add_header Access-Control-Allow-Credentials "true";
            add_header Content-Length 0;
            add_header Content-Type text/plain;
            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 $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_connect_timeout 600;
        proxy_send_timeout 600;
        proxy_read_timeout 600;
        send_timeout 600;
        add_header Access-Control-Allow-Origin "$http_origin";
        add_header Access-Control-Allow-Credentials "true";
        add_header Access-Control-Allow-Methods "GET, PUT, POST, DELETE, OPTIONS";
        add_header Access-Control-Allow-Headers "Content-Type,*";
        #rewrite ^/api/(.*)$ /$1 break;
        #rewrite ^(.*)$ https://192.168.1.130 permanent;
        #proxy_pass http://gateways;
        proxy_pass https://192.168.1.230:8006;        
    } 

    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/jeebiz.picp.vip.log;
    error_log  /www/wwwlogs/jeebiz.picp.vip.error.log;
}
作者:Jeebiz  创建时间:2020-03-09 22:59
 更新时间:2023-03-28 22:49