<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 4. 在線升級 #### 1. 緣由 公司有一個項目,需要用到websocket,所謂websocket是基于tcp/ip的協議,它跟http協議是同等級的。它解決的問題是長輪循的資源消耗問題。也就是用它做類似長輪循的應用時,因為本身協議的支持,資源消耗是較低的。類似的應用可以是聊天室,通知系統,股票實時更新等。具體的我們不再細說。由于我們項目是部署在nginx上的,用的ruby on rails開發的,使用的gem是[actioncable](https://github.com/rails/actioncable)。rails程序是用unicorn部署的,websocket是用puma來部署,也是actioncable默認建議的。也就是兩個程序,一個是web的,一個是websocket的。兩個都是掛在nginx下。nginx作為反向代理服務器,代理請求到unicorn或puma,unciron或puma處理后,交給nginx,nginx再轉發給客戶端。nginx作為高性能的服務器,起到緩沖作用,主要的壓力也是集中在nginx上,這也是一般rails程序的部署情況。 之前unicorn是部署好的。這個時候要加上puma。仿照unicorn在nginx的配置,puma在nginx也是一樣的。都是用proxy\_pass加上upstream就可以搞定。關于nginx的具體配置問題可以查看本站nginx相關的文章。這里不再詳述。 配置好了。剛開始第一次發出請求可以成功的,因為我監控了puma的日志,能夠產生正確的請求日志,但發出第二次就不行了,總是超時。最后我查到了原因,原來是nginx在1.4以上才支持websocket。我發現線上centos用yum安裝的nginx版本才是1.0,真是醉了。關于如果如何查看websocket請求的問題可以查看本站websocket相關的文章。 我想給nginx來個升級,但最好是無破壞的升級。假如你在線上還有程序在跑,你可不能破壞掉。不然由此造成的業務損失,可得怪你。 #### 2. 升級過程 在安裝前先執行下面的命令,這是我安裝過程中遇到的問題。先安裝就能避免了。 ``` sudo yum -y install pcre-devel openssl openssl-devel ``` 在官網上找到了nginx的最新穩定版本,下載下來,然后解壓縮。 ``` cd nginx ./configure \ --prefix=/etc/nginx \ --sbin-path=/usr/sbin/nginx \ --conf-path=/etc/nginx/nginx.conf \ --pid-path=/var/run/nginx.pid \ --lock-path=/var/run/nginx.lock \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --with-http_gzip_static_module \ --with-http_stub_status_module \ --with-http_ssl_module \ --with-pcre \ --with-file-aio \ --with-http_realip_module \ --without-http_scgi_module \ --without-http_uwsgi_module \ --without-http_fastcgi_module make sudo make install ``` 關于這里面的參數,可以使用`nginx -V`查看。 這個時候已經安裝完畢了,但是你還沒有用新nginx來啟動,還有,老的nginx還在用著呢,如何無縫啟動呢。 Makefile提供了一個命令 ``` sudo make upgrade ``` 就好了。這樣可以殺死舊的nginx進程,用新的來代替。詳細的你可以查看Makefile文件。 完結。
                  <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>

                              哎呀哎呀视频在线观看