<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                今天見到了另外一種動靜分離的配置方式:這樣的方式不太推薦。 > 今天老板又從客戶那里帶來了告急問題~說主頁訪問不了 經過nginx的排查,發現連靜態頁面都無法訪問。經過仔細的排查、測試,終于真相大白。 ## 一、帶雷的配法 該服務中的nginx是這樣配置的,我們把它稱為**配法一**: ``` server { listen 80; server_name ywhyhb.cn www.ywhyhb.cn; location / { proxy_pass http://localhost:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #以下三句話是對websocket的支持.轉換1.1協議為websocket proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; root html; index index.html index.htm; } location /index { root /usr/local/webdata/html/home; index index.html; } } ``` 配法一的缺陷: - 當動態服務出現問題的時候,靜態頁面也無法訪問。 原理是這樣的: ![](https://gitee.com/cowboy2014/cloud2020-config/raw/master/pictures/20210422181536.png) ## 二、安全的配置方法 ``` server { listen 80; server_name localhost; location / { root /data/work/html/angular-admin; try_files $uri $uri/ /index.html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location /api-file { proxy_pass http://192.168.30.22:9200/api-file; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } ``` ![](https://gitee.com/cowboy2014/cloud2020-config/raw/master/pictures/20210422181622.png) 這樣的情形下,當動態服務掛掉的時候,也不會影響靜態資源的訪問。更利于開發人員定位問題。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看