作者:Eddy  历史版本:1  最后编辑:Eddy  更新时间:2024-05-15 14:48

编写版本:所有
适用版本:所有

nginx.conf

nginx 的配置文件

请注意看“重点!重点!重点!”的 配置,根据实际情况配置

#user  nobody;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    client_max_body_size 100m;

    sendfile        on;
    keepalive_timeout  65;
    proxy_connect_timeout 600;
    proxy_read_timeout 600;

    gzip  on;
    gzip_min_length  1k;
    gzip_buffers     4 16k;
    gzip_http_version 1.1;
    gzip_comp_level 9;
    gzip_types       text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php application/javascript application/json;
    gzip_disable "MSIE [1-6]\.";
    gzip_vary on;

    underscores_in_headers on;# IBPS令牌转发配置,必须开启

    server {
        # 适用版本
        # 以下https转发配置。重点!重点!重点!
        listen       80 ssl http2;
        server_name  localhost;

        # 适用版本
        # 以下https转发配置。重点!重点!重点!
        ssl_certificate              /etc/nginx/certs/nginx.crt;
        ssl_certificate_key          /etc/nginx/certs/nginx.key;
        ssl_session_cache            shared:SSL:1m;
        ssl_session_timeout          5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers    on;

        location / {
            root   html;
            index  index.html index.htm;
            try_files  $uri $uri/ /index.html;
        }

        # 适用版本
        # 以下https转发配置。重点!重点!重点!
        location /gateway/ {
            proxy_pass http://192.168.3.220:40002/;
        }

        # 适用版本v3.5.4+
        # 以下wss转发配置。重点!重点!重点!
        location /gateway/ibps/ws/ {
            proxy_pass http://192.168.3.220:40002/ibps/ws/;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

    }
}

前端配置文件

前端配置文件:config.js

请注意看“重点!重点!重点!”的 配置,根据实际情况配置

(function (global) {
  global.__IBPS_CONFIG__={
     //================请求相关配置=====================
     //----------------启动该配置,env下配置的地址无效start-----------------
    // 是否启用配置,启动该配置,env下配置的地址无效
    ENABLE_CONFIG:true,
    //  api
    BASE_API:'https://192.168.3.230:10000/gateway/ibps',// 重点!重点!重点!
    // GATEWAY API
    BASE_GATEWAY_API:'https://192.168.3.230:10000/gateway',// 重点!重点!重点!
    // report api
    BASE_REPORT_API : 'http://192.168.3.230:8080/raqsoft',
    // 是否单体应用
    SINGLE:false,
    //----------------启动该配置,env下配置的地址无效end-----------------

    ...
  }

})(window)