国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

內(nèi)網(wǎng)走nginx代理訪問高德webapi2.0

這篇具有很好參考價(jià)值的文章主要介紹了內(nèi)網(wǎng)走nginx代理訪問高德webapi2.0。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

需求:客戶的電腦都只能訪問內(nèi),服務(wù)器可以訪問外網(wǎng),客戶電腦使用的項(xiàng)目中用到了高德webapi2.0。
10.200.31.45:32100是我們的web服務(wù)器。

網(wǎng)上基本上都是對(duì)高德webapi1.4的配置方式,而web2.0有一些差別。

1.前端修改高德地圖的js應(yīng)用

如果是index.html引入,

修改之前的應(yīng)用:

    <script type="text/javascript" crossorigin
        src="https://webapi.amap.com/maps?v=2.0&key=高德key&plugin=AMap.ToolBar, AMap.ControlBar,AMap.MoveAnimation,AMap.RangingTool,AMap.Geocoder"></script>
    <script src="https://webapi.amap.com/loca?v=2.0.0&key=高德key"></script>

修改之后的配置:

    <script type="text/javascript" crossorigin
    src="<%= BASE_URL %>maps?v=2.0&key=高德key&plugin=AMap.ToolBar, AMap.ControlBar,AMap.MoveAnimation,AMap.RangingTool,AMap.Geocoder"></script>
<script src="<%= BASE_URL %>loca?v=2.0.0&key=高德key"></script>

如果是js動(dòng)態(tài)加載,代碼如下:

/**
 * 創(chuàng)建高德秘鑰
 * @param secret 
 */
export function createSecret(secret?:string){
         secret=secret||'高德秘鑰';
         // 拼裝腳本字符串
         const script = document.createElement('script');
          // 高德 Web API 初始化配置
         script.innerHTML = `
           window._AMapSecurityConfig = {
            securityJsCode: '${secret}',
          };`;
         // 將腳本插入到頁面頭部
         document.head.appendChild(script);
}
//獲取地圖地址
const getMapUrl=()=>{
  const {map_offline}=Local.getAmapConfig();
  let mapUrl='https://webapi.amap.com';
   if(map_offline){
    mapUrl='';
   }
  if (process.env.NODE_ENV === "development"){
    mapUrl='https://webapi.amap.com';
  }
  return mapUrl;
}
/**
 * 創(chuàng)建高德script引入腳本
 * @param key 
 * @param url 
 */
export function loadAMapScript(url:string,key?:string) {
  key=key||'高德key';
  const mapUrl=getMapUrl();
  const src =`${mapUrl}/maps?v=2.0&key=${key}${url}`;
  console.log('我的src',src);
  return new Promise((resolve, reject) => {
    const script = document.createElement('script');
    script.src = src;
    script.async = true;
    script.onerror = reject;
    script.onload = resolve;
    document.head.appendChild(script);
  });
}
/**
 * 創(chuàng)建高德local script引入腳本
 * @param key 
 * @param url 
 */
 export function loadAMapLocaScript(key?:string,url?:string=''){
  key=key||'高德key';
  const mapUrl=getMapUrl();
  const src =`${mapUrl}/loca?v=2.0&key=${key}${url}`;
  return new Promise((resolve, reject) => {
    const script = document.createElement('script');
    script.src = src;
    script.async = true;
    script.onerror = reject;
    script.onload = resolve;
    document.head.appendChild(script);
  });
}

然后在main.ts中:

import {DefaultAmapConfig} from "@/xd-common-web/xdConst";
import {loadAMapLocaScript,loadAMapScript,createSecret} from "@/xd-common-web/utils/map/amapLink";
try{
console.log('開始加載地圖');
const mapConfig=Local.getAmapConfig()||DefaultAmapConfig;
createSecret(mapConfig.map_secret);
await loadAMapScript("&&plugin=AMap.LineSearch,AMap.StationSearch,AMap.PolylineEditor,AMap.Geocoder,AMap.PlaceSearch,AMap.AutoComplete,Amap.ElasticMarker,AMap.PolygonEditor",mapConfig.map_key);
await loadAMapLocaScript(mapConfig.map_key);
  console.log('地圖加載成功');
} catch{
  console.log('地圖加載異常');
}

2.nginx配置如下:

       location /restapi/ {
          proxy_pass https://restapi.amap.com/;
        }
       location /restapi/v3/ {
          proxy_pass https://restapi.amap.com/v3/;
        }
        location /webapi/ {
                proxy_pass https://webapi.amap.com/;
        }
        location /webapi/count{
           proxy_pass https://webapi.amap.com/count;
        }
        location /vdata/ {
                proxy_pass https://vdata.amap.com/;
        }
       location /vdata/style_icon/ {
            proxy_pass   http://vdata.amap.com/style_icon/;
        }
       location /vdata/style/{
           proxy_pass https://vdata.amap.com/style/;
        }
        location /vdata01/ {
             proxy_pass   https://vdata01.amap.com/;
        }
        location /vdata02/ {
             proxy_pass   https://vdata02.amap.com/;
        }
         location /vdata03/ {
             proxy_pass   https://vdata03.amap.com/;
        }
        location /vdata04/ {
             proxy_pass   https://vdata04.amap.com/;
        }
         location /wprd01/ {
            proxy_pass   https://wprd01.is.autonavi.com/;
        }
        location /wprd02/ {
            proxy_pass   https://wprd02.is.autonavi.com/;
        }
        location /wprd03/ {
            proxy_pass   https://wprd03.is.autonavi.com/;
        }
        location /wprd04/ {
            proxy_pass   https://wprd04.is.autonavi.com/;
        }
       location /webrd01/ {
          proxy_pass   https://webrd01.is.autonavi.com/;
        }
        location /webrd02/ {
            proxy_pass   https://webrd02.is.autonavi.com/;
        }
        location /webrd03/ {
            proxy_pass   https://webrd03.is.autonavi.com/;
        }
        location /webrd04/ {
            proxy_pass   https://webrd04.is.autonavi.com/;
        }

        #代理獲取js api文件并修改文件內(nèi)容
        location /maps {
            proxy_set_header Accept-Encoding "";
            proxy_pass https://webapi.amap.com/maps;
            sub_filter_types *;
            sub_filter_once off;
            sub_filter 'http://webapi.amap.com' 'http://10.200.31.45:32100/webapi';
            sub_filter 'https://webapi.amap.com' 'http://10.200.31.45:32100/webapi';
            sub_filter 'http://restapi.amap.com' 'http://10.200.31.45:32100/restapi';
            sub_filter 'https://restapi.amap.com' 'http://10.200.31.45:32100/restapi';
            sub_filter 'http://vdata.amap.com' 'http://10.200.31.45:32100/vdata';
            sub_filter 'https://vdata.amap.com' 'http://10.200.31.45:32100/vdata';
            sub_filter 'webapi.amap.com' '10.200.31.45:32100/webapi';
            sub_filter 'vdata.amap.com' '10.200.31.45:32100/vdata';
            sub_filter 'restapi.amap.com' '10.200.31.45:32100/restapi';

            sub_filter 'vdata0{1,2,3,4}.amap.com' '10.200.31.45:32100/vdata0{1,2,3,4}';
            sub_filter '{vdata,vdata01,vdata02,vdata03,vdata04}.amap.com' '10.200.31.45:32100/{vdata,vdata01,vdata02,vdata03,vdata04}';
            sub_filter 'webapi.amap.com/count' '10.200.31.45:32100/webapi/count';
            sub_filter 'webapi.amap.com/theme' '10.200.31.45:32100/webapi/theme';
            sub_filter 'restapi.amap.com/v3' '10.200.31.45:32100/restapi/v3';
            sub_filter 'webapi.amap.com/style' '10.200.31.45:32100/webapi/style';

           sub_filter 'wprd0{1,2,3,4}.is.autonavi.com' '10.200.31.45:32100/wprd0{1,2,3,4}';
           sub_filter 'webrd0{1,2,3,4}.is.autonavi.com' '10.200.31.45:32100/wprd0{1,2,3,4}';

           sub_filter 'https' 'http';
        }
        location /loca {
            proxy_set_header Accept-Encoding "";
            proxy_pass   https://webapi.amap.com/loca;
            sub_filter_types *;
            sub_filter_once off;
            sub_filter 'webapi.amap.com/count' '10.200.31.45:32100/webapi/count';   
            sub_filter 'https' 'http';
        }

至此,就配置好了。注意:實(shí)際項(xiàng)目中nginx配置文件中的10.200.31.45:32100可使用變量代替。完整版配置如下:

location /restapi/ {
proxy_pass https://restapi.amap.com/;
}
location /webapi/ {
proxy_pass https://webapi.amap.com/;
}
location /vdata/ {
proxy_pass https://vdata.amap.com/;
}
location ^~/webapi/theme{
proxy_pass https://webapi.amap.com/theme;
}
location /vdata/ {
proxy_pass https://vdata.amap.com/;
}
location ^~/vdata/style_icon/ {
proxy_pass http://vdata.amap.com/style_icon/;
}
location /vdata01/ {
proxy_pass https://vdata01.amap.com/;
}
location /vdata02/ {
proxy_pass https://vdata02.amap.com/;
}
location /vdata03/ {
proxy_pass https://vdata03.amap.com/;
}
location /vdata04/ {
proxy_pass https://vdata04.amap.com/;
}
location /wprd01/ {
proxy_pass https://wprd01.is.autonavi.com/;
}
location /wprd02/ {
proxy_pass https://wprd02.is.autonavi.com/;
}
location /wprd03/ {
proxy_pass https://wprd03.is.autonavi.com/;
}
location /wprd04/ {
proxy_pass https://wprd04.is.autonavi.com/;
}
location /webrd01/ {
proxy_pass https://webrd01.is.autonavi.com/;
}
location /webrd02/ {
proxy_pass https://webrd02.is.autonavi.com/;
}
location /webrd03/ {
proxy_pass https://webrd03.is.autonavi.com/;
}
location /webrd04/ {
proxy_pass https://webrd04.is.autonavi.com/;
}


#代理獲取js api文件并修改文件內(nèi)容
location /maps {
set $proxyip "10.200.31.45:32100";
proxy_set_header Accept-Encoding "";
proxy_pass https://webapi.amap.com/maps;
sub_filter_types *;
sub_filter_once off;

sub_filter 'webapi.amap.com' '$proxyip/webapi';
sub_filter 'vdata.amap.com' '$proxyip/vdata';
sub_filter 'restapi.amap.com' '$proxyip/restapi';
sub_filter 'vdata0{1,2,3,4}.amap.com' '$proxyip/vdata0{1,2,3,4}';
sub_filter '{vdata,vdata01,vdata02,vdata03,vdata04}.amap.com' '$proxyip/{vdata,vdata01,vdata02,vdata03,vdata04}';
sub_filter 'wprd0{1,2,3,4}.is.autonavi.com' '$proxyip/wprd0{1,2,3,4}';
sub_filter 'webrd0{1,2,3,4}.is.autonavi.com' '$proxyip/wprd0{1,2,3,4}';


sub_filter 'https' 'http';
}
location /loca {
set $proxyip "10.200.31.45:32100";
proxy_set_header Accept-Encoding "";
proxy_pass https://webapi.amap.com/loca;
sub_filter_types *;
sub_filter_once off;
sub_filter 'webapi.amap.com/count' '$proxyip/webapi/count';
sub_filter 'https' 'http';
}

實(shí)現(xiàn)思路:通過特定的前綴maps和loca把高德webapi的引用進(jìn)行轉(zhuǎn)發(fā),轉(zhuǎn)發(fā)之后,高德加載地圖時(shí),自動(dòng)會(huì)調(diào)用一些接口,使用sub_filter 對(duì)返回的內(nèi)容進(jìn)行替換,替換為服務(wù)器的地址+特定前綴,再根據(jù)前綴二次轉(zhuǎn)發(fā)即可。

如果要兼容1.4.15的api,需要添加如下配置:

           location /mapsold {
            set $proxyip "10.200.31.45:32100";
            proxy_set_header Accept-Encoding "";
            proxy_pass https://webapi.amap.com/maps;
            sub_filter_types *;
            sub_filter_once off;
            sub_filter 'http://webapi.amap.com' 'http://$proxyip/webapi';
            sub_filter 'https://webapi.amap.com' 'http://$proxyip/webapi';
            sub_filter 'http://restapi.amap.com' 'http://$proxyip/restapi';
            sub_filter 'http://vdata.amap.com' 'http://$proxyip/vdata';
            sub_filter 'vdata.amap.com' '$proxyip/vdata';
            sub_filter 'vdata0{1,2,3,4}.amap.com' '$proxyip/vdata0{1,2,3,4}';
            sub_filter 'webapi.amap.com/count' '$proxyip/webapi/count';
            sub_filter 'wprd0{1,2,3,4}.is.autonavi.com' '$proxyip/wprd0{1,2,3,4}';
            sub_filter 'webapi.amap.com/theme' '$proxyip/webapi/theme';
            sub_filter 'restapi.amap.com/v4' '$proxyip/restapi/v4';
            sub_filter 'restapi.amap.com/v3' '$proxyip/restapi/v3';
            sub_filter 'webapi.amap.com/style' '$proxyip/webapi/style';
        }

最終配置如下:

  location /restapi/ {
            proxy_pass https://restapi.amap.com/;
        }

        location ^~/webapi/ {
            proxy_pass https://webapi.amap.com/;
        }

        location /vdata/ {
            proxy_pass https://vdata.amap.com/;
        }
        location ^~/webapi/theme{
            proxy_pass https://webapi.amap.com/theme;
        }
        location ^~/style_icon/ {
            proxy_pass  http://vdata.amap.com/style_icon/;
        }
        location /wprd01/ {
            proxy_pass   https://wprd01.is.autonavi.com/;
        }
        location /wprd02/ {
            proxy_pass   https://wprd02.is.autonavi.com/;
        }
        location /wprd03/ {
            proxy_pass   https://wprd03.is.autonavi.com/;
        }
        location /wprd04/ {
            proxy_pass   https://wprd04.is.autonavi.com/;
        }

       location /webrd01/ {
            proxy_pass   https://webrd01.is.autonavi.com/;
        }
        location /webrd02/ {
            proxy_pass   https://webrd02.is.autonavi.com/;
        }
        location /webrd03/ {
            proxy_pass   https://webrd03.is.autonavi.com/;
        }
        location /webrd04/ {
            proxy_pass   https://webrd04.is.autonavi.com/;
        }

       location /webst01/ {
            proxy_pass   https://webst01.is.autonavi.com/;
        }
        location /webst02/ {
            proxy_pass   https://webst02.is.autonavi.com/;
        }
        location /webst03/ {
            proxy_pass   https://webst03.is.autonavi.com/;
        }
        location /webst04/ {
            proxy_pass   https://webst04.is.autonavi.com/;
        }

        location ^~/webapi/ui/{
           proxy_pass https://webapi.amap.com/ui/;
        }

        location /maps {
            set $proxyip "$XD_DBO_CTRL_WEB";
            proxy_set_header Accept-Encoding "";
            proxy_pass https://webapi.amap.com/maps;
            sub_filter_types *;
            sub_filter_once off;
            sub_filter 'webapi.amap.com' '$proxyip/webapi';
            sub_filter 'vdata.amap.com' '$proxyip/vdata';
            sub_filter 'restapi.amap.com' '$proxyip/restapi';
            sub_filter 'vdata0{1,2,3,4}.amap.com' '$proxyip/vdata0{1,2,3,4}';
            sub_filter '{vdata,vdata01,vdata02,vdata03,vdata04}.amap.com' '$proxyip/{vdata,vdata01,vdata02,vdata03,vdata04}';
            sub_filter 'wprd0{1,2,3,4}.is.autonavi.com' '$proxyip/wprd0{1,2,3,4}';
            sub_filter 'webrd0{1,2,3,4}.is.autonavi.com' '$proxyip/webrd0{1,2,3,4}';
            sub_filter 'https' 'http';
            sub_filter '暫未獲得高德開放平臺(tái)商用授權(quán)' '';
        }

        location /loca {
            set $proxyip "$XD_DBO_CTRL_WEB";
            proxy_set_header Accept-Encoding "";
            proxy_pass   https://webapi.amap.com/loca;
            sub_filter_types *;
            sub_filter_once off;
            sub_filter 'webapi.amap.com/count' '$proxyip/webapi/count';   
            sub_filter 'https' 'http';
        }
        location /mapsold {
            set $proxyip "$XD_DBO_CTRL_WEB";
            proxy_set_header Accept-Encoding "";
            proxy_pass https://webapi.amap.com/maps;
            sub_filter_types *;
            sub_filter_once off;
            sub_filter 'http://webapi.amap.com' 'http://$proxyip/webapi';
            sub_filter 'https://webapi.amap.com' 'http://$proxyip/webapi';
            sub_filter 'http://restapi.amap.com' 'http://$proxyip/restapi';
            sub_filter 'http://vdata.amap.com' 'http://$proxyip/vdata';
            sub_filter 'vdata.amap.com' '$proxyip/vdata';

            sub_filter 'webrd0{1,2,3,4}.is.autonavi.com' '$proxyip/webrd0{1,2,3,4}';
            sub_filter 'webst0{1,2,3,4}.is.autonavi.com' '$proxyip/webst0{1,2,3,4}';
            sub_filter 'vdata0{1,2,3,4}.amap.com' '$proxyip/vdata0{1,2,3,4}';
            sub_filter 'webapi.amap.com/count' '$proxyip/webapi/count';
            sub_filter 'wprd0{1,2,3,4}.is.autonavi.com' '$proxyip/wprd0{1,2,3,4}';
            sub_filter 'webapi.amap.com/theme' '$proxyip/webapi/theme';
            sub_filter 'restapi.amap.com/v4' '$proxyip/restapi/v4';
            sub_filter 'restapi.amap.com/v3' '$proxyip/restapi/v3';
            sub_filter 'webapi.amap.com/style' '$proxyip/webapi/style';
            sub_filter '暫未獲得高德開放平臺(tái)商用授權(quán)' '';
        }

        location ^~/ui/ {
            set $proxyip "$XD_DBO_CTRL_WEB";
            proxy_set_header Accept-Encoding "";
            proxy_pass   https://webapi.amap.com/ui/;
            sub_filter_types *;
            sub_filter_once off;
            sub_filter 'webapi.amap.com/count' '$proxyip/webapi/count';   
            sub_filter 'webapi.amap.com' '$proxyip/webapi';
            sub_filter 'https' 'http';
        }

1.4的版本有兩個(gè)圖片文件如法替換,需要js替換,代碼如下:

let proxyip='${systemConfig.offlineMapUrl}';
/*
*全局?jǐn)r截Image的圖片代理高德
 *
 */
function hookImg() {
  const property = Object.getOwnPropertyDescriptor(Image.prototype, 'src')
  const nativeSet = property.set
  function customiseSrcSet(url) {
    // 1.4.15版本的地圖,這兩個(gè)圖片找不到來源,只能在這里捕獲代理
    if (url.toString().search('http://vdata.amap.com/style_icon/icon-normal-small.png') !== -1) {
      url =proxyip+ '/style_icon/icon-normal-small.png'
    } else if (url.toString().search('http://vdata.amap.com/style_icon/icon-biz-small.png') !== -1) {
      url = proxyip+ '/style_icon/icon-biz-small.png'
    } else if (url.toString().search('https://vdata.amap.com/style_icon/icon-normal-small.png') !== -1) {
      url = proxyip+ '/style_icon/icon-normal-small.png'
    } else if (url.toString().search('https://vdata.amap.com/style_icon/icon-biz-small.png') !== -1) {
      url = proxyip+ '/style_icon/icon-biz-small.png'
    }
    nativeSet.call(this, url)
  }
    Object.defineProperty(Image.prototype, 'src', {
    set: customiseSrcSet
  })
}

完!文章來源地址http://www.zghlxwxcb.cn/news/detail-746273.html

到了這里,關(guān)于內(nèi)網(wǎng)走nginx代理訪問高德webapi2.0的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • nginx 內(nèi)網(wǎng)互相訪問

    nginx ? 下載地址 http://nginx.p2hp.com/en/download.html conf/nginx.conf ? ?配置 ?server { ? ? ? ? listen ? ? ? 8090; ? ? ? ? server_name ?172.xx.xx.xx; //自己內(nèi)網(wǎng)地址 ? ? ? ? #charset koi8-r; ? ? ? ? #access_log ?logs/host.access.log ?main; ? ? ? ? location / { ? ? ? ? ? ? #root ? html; ? ? ? ? ? ? #inde

    2023年04月15日
    瀏覽(17)
  • 紅隊(duì)隧道應(yīng)用篇之Burpsuite設(shè)置上游代理訪問內(nèi)網(wǎng)(五)

    紅隊(duì)隧道應(yīng)用篇之Burpsuite設(shè)置上游代理訪問內(nèi)網(wǎng)(五)

    Burp Suite設(shè)置上游代理的主要原因是為了攔截和修改來自瀏覽器的請(qǐng)求。當(dāng)您在使用Burp Suite進(jìn)行Web應(yīng)用程序安全測(cè)試時(shí),您可能希望模擬攻擊者發(fā)送惡意請(qǐng)求,以測(cè)試應(yīng)用程序是否能夠防御這些攻擊。使用上游代理可以幫助您在瀏覽器和目標(biāo)服務(wù)器之間插入Burp Suite,從而使您

    2024年02月04日
    瀏覽(21)
  • Nginx外網(wǎng)訪問內(nèi)網(wǎng)如何實(shí)現(xiàn)

    Nginx外網(wǎng)訪問內(nèi)網(wǎng)如何實(shí)現(xiàn)

    ? ? ? ? 項(xiàng)目要求:將甲方內(nèi)網(wǎng)的項(xiàng)目能夠?qū)ν庠L問,甲方提供一個(gè)中間過渡服務(wù)器,中間過渡服務(wù)器與外網(wǎng)互通,且中間服務(wù)器可以訪問內(nèi)網(wǎng); ? ? ? ? 外網(wǎng)客戶端-中間過渡服務(wù)器開放端口:80 ? ? ? ? 中間過渡服務(wù)器-內(nèi)網(wǎng)服務(wù)器開放端口:80、9095 ? ? ? ? 系統(tǒng)架構(gòu):

    2024年02月07日
    瀏覽(24)
  • Linux內(nèi)網(wǎng)服務(wù)器通過代理訪問外網(wǎng)服務(wù)器

    Linux內(nèi)網(wǎng)服務(wù)器通過代理訪問外網(wǎng)服務(wù)器

    目錄 一、環(huán)境介紹 二、安裝squid 三、配置代理 擴(kuò)展一、JAVA應(yīng)用通過代理訪問外網(wǎng) 擴(kuò)展二、通過nginx代理實(shí)現(xiàn)yum跳轉(zhuǎn) 擴(kuò)展三、代理harbor鏡像方式訪問 192.168.7.131可以通外網(wǎng) 192.168.7.129不通外網(wǎng) 需要通過代理的方式實(shí)現(xiàn)192.168.7.129可以訪問外網(wǎng) ?1、在192.168.7.131主機(jī)(可以訪問外

    2024年02月08日
    瀏覽(21)
  • 利用Apache實(shí)現(xiàn)正向代理,使內(nèi)網(wǎng)服務(wù)器可以訪問外網(wǎng)

    利用Apache實(shí)現(xiàn)正向代理,使內(nèi)網(wǎng)服務(wù)器可以訪問外網(wǎng)

    提示:文章寫完后,目錄可以自動(dòng)生成,如何生成可參考右邊的幫助文檔 正向代理和反向代理的定義可以自己查詢資料,通常用的較多的場(chǎng)景使用Nginx作為反向代理服務(wù)器,Nginx做正向代理服務(wù)器時(shí)僅可以訪問HTTP網(wǎng)站,不能訪問HTTPS網(wǎng)站,用處不大。 本文所需要的準(zhǔn)備,一臺(tái)

    2024年01月20日
    瀏覽(48)
  • 具有公網(wǎng)IP的服務(wù)器作為代理服務(wù)器,并使用Nginx將內(nèi)網(wǎng)服務(wù)器反向代理

    在代理服務(wù)器上安裝Nginx。如果您正在使用Linux操作系統(tǒng),則可以使用包管理器來安裝Nginx。例如,如果您使用的是Ubuntu,可以使用以下命令安裝: 配置Nginx以將HTTP和HTTPS請(qǐng)求轉(zhuǎn)發(fā)到內(nèi)部服務(wù)器。打開Nginx的主配置文件/etc/nginx/nginx.conf,并在http塊中添加以下代碼: 注意: 將

    2024年01月25日
    瀏覽(30)
  • nginx 代理sftp,達(dá)到訪問nginx服務(wù)器就間接訪問sftp服務(wù)器

    nginx 代理sftp,達(dá)到訪問nginx服務(wù)器就間接訪問sftp服務(wù)器

    測(cè)試環(huán)境部署規(guī)劃: 192.168.0.101 nginx 服務(wù)器? ? 192.168.0.102 sftp 服務(wù)器? 192.168.0.103? 作為客戶端去訪問,這里三臺(tái)機(jī)器選用centos 7.9系統(tǒng),客戶端可以使用window,軟件訪問sftp服務(wù)! 首先 1.在192.168.0.101機(jī)器上部署nginx? 步驟:?#安裝依賴 yum install gcc pcre-devel openssl-devel? wget -y?

    2024年02月16日
    瀏覽(33)
  • Nginx代理Grafana,鑒權(quán)訪問以及Grafan免登錄訪問

    Nginx代理Grafana,鑒權(quán)訪問以及Grafan免登錄訪問

    在使用 grafana 做頁面嵌入的場(chǎng)景中,通常需要 grafana 與前端在同域下,方便鑒權(quán)、解決跨域。 Nginx 代理 Grafana 后,就不能使用 Grafana 中默認(rèn)配置的端口和路徑進(jìn)行訪問,必須通過 Nginx 訪問 Grafana 。 如果需要做 Iframe 嵌入自研系統(tǒng)時(shí),存在鑒權(quán)問題,在同域名下可以使用 IFr

    2024年02月17日
    瀏覽(12)
  • Xshell+Xftp通過代理的方式訪問局域網(wǎng)內(nèi)網(wǎng)服務(wù)器

    Xshell+Xftp通過代理的方式訪問局域網(wǎng)內(nèi)網(wǎng)服務(wù)器

    最近在部署項(xiàng)目時(shí)遇到只有1臺(tái)服務(wù)器擁有公網(wǎng)ip,其它服務(wù)器只有局域網(wǎng)ip,當(dāng)然其它服務(wù)器可以正常訪問網(wǎng)絡(luò),例如如下模型。之前訪問其它幾臺(tái)服務(wù)器,都是先通過登錄公網(wǎng)IP服務(wù)器,然后在Xshell里面執(zhí)行ssh遠(yuǎn)程連接,這種方式不夠直觀而且上傳文件到其它服務(wù)器很繁瑣,

    2024年02月03日
    瀏覽(26)
  • Nginx反向代理,讓網(wǎng)頁可以被別人訪問

    Nginx反向代理,讓網(wǎng)頁可以被別人訪問

    1、下載Nginx ? 想要使用Nginx反向代理首先進(jìn)入Nginx官網(wǎng) 2、在右側(cè)選擇download 3、選擇自己操作系統(tǒng)的穩(wěn)定版本 4、解壓壓縮包 5、進(jìn)入html文件夾 ?把想要代理的網(wǎng)頁替換文件夾中的index.html 6、回到nginx解壓的主目錄打開nginx.exe ?如果沒有出現(xiàn)小黑框也沒事。 7、打開瀏覽器,

    2024年02月06日
    瀏覽(22)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包