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

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                **Nginx相關資料請參閱[Nginx中文文檔](http://tengine.taobao.org/nginx_docs/cn/docs/)** # Nginx模塊 Nginx模塊共有下面的這些: - ngx_http_core_module - ngx_http_access_module - ngx_http_addition_module - ngx_http_auth_basic_module - ngx_http_autoindex_module - ngx_http_browser_module - ngx_http_charset_module - ngx_http_dav_module - ngx_http_empty_gif_module - ngx_http_fastcgi_module - ngx_http_flv_module - ngx_http_geo_module - ngx_http_geoip_module - ngx_http_gunzip_module - ngx_http_gzip_module - ngx_http_gzip_static_module - ngx_http_headers_module - ngx_http_image_filter_module - ngx_http_index_module - ngx_http_limit_conn_module - ngx_http_limit_req_module - ngx_http_log_module - ngx_http_map_module - ngx_http_memcached_module - ngx_http_mp4_module - ngx_http_perl_module - ngx_http_proxy_module - ngx_http_random_index_module - ngx_http_realip_module - ngx_http_referer_module - ngx_http_rewrite_module - ngx_http_secure_link_module - ngx_http_split_clients_module - ngx_http_ssi_module - ngx_http_ssl_module - ngx_http_sub_module - ngx_http_upstream_module - ngx_http_userid_module - ngx_http_xslt_module - ngx_mail_core_module - ngx_mail_pop3_module - ngx_mail_imap_module - ngx_mail_smtp_module - ngx_mail_auth_http_module - ngx_mail_proxy_module - ngx_mail_ssl_module # 模塊使用舉例 在這里我只介紹其中的四個模塊,其他模塊用法請參閱[Nginx中文文檔](http://tengine.taobao.org/nginx_docs/cn/docs/) ## ngx_http_access_module 模塊 ngx_http_access_module 允許限制某些IP地址的客戶端訪問。也可以通過 密碼來限制訪問。 使用 satisfy 指令就能同時通過IP地址和密碼來限制訪問。 配置范例: location / { deny 192.168.0.21; allow 192.168.0.0/24; deny all; } 規則按照順序依次檢測,直到匹配到第一條規則。 在這個例子里,IPv4的網絡中只有192.168.0.0/24允許訪問,但 192.168.0.21除外, 在規則很多的情況下,使用 ngx_http_geo_module 模塊變量更合適。 192.168.0.21訪問nginx返回403錯誤: ![3-2-5-1](http://pded8ke3e.bkt.clouddn.com/3-2-5-1.png) ## ngx_http_auth_basic_module 模塊ngx_http_auth_basic_module 允許使用“HTTP基本認證”協議驗證用戶名和密碼來限制對資源的訪問。也可以通過 地址來限制訪問。 使用satisfy 指令就能同時通過地址和密碼來限制訪問。 使用這個模塊需要httpd htpasswd的支持,所以我們先安裝httpd ``` [root@tengine-1 conf]# yum -y install httpd [root@tengine-1 conf]# htpasswd -bcm /var/user yjscloud 123456 #創建訪問前端訪問的用戶和密碼 Adding password for user yjscloud [root@tengine-1 conf]# cat /var/user yjscloud:$apr1$G1Cf7JMP$cw0.ofGQ6w7dbaMqDJACs. ``` 修改配置文件: ![3-2-6](http://pded8ke3e.bkt.clouddn.com/3-2-6.png) /etc/rc.d/init.d/nginx restart 前端查看: ![3-2-7](http://pded8ke3e.bkt.clouddn.com/3-2-7.png) ## ngx_http_proxy_module 什么是反向代理? - 通常的代理服務器,只用于代理內部網絡對Internet的連接請求,客戶機必須指定代理服務器,并將本來要直接發送到Web服務器上的http請求發送到代理服務器中由代理服務器向Internet上的web服務器發起請求,最終達到客戶機上網的目的。 - 而反向代理(Reverse Proxy)方式是指以代理服務器來接受internet上的連接請求,然后將請求轉發給內部網絡上的服務器,并將從服務器上得到的結果返回給internet上請求連接的客戶端,此時代理服務器對外就表現為一個反向代理服務器 ![3-2-8](http://pded8ke3e.bkt.clouddn.com/3-2-8.png) 單點的反向代理配置: 首先我們要安裝一個tomcat,將`apache-tomcat-7.0.61.tar.gz`安裝包上傳到/opt目錄下,需要下載tomcat的小伙伴[請點擊這里](https://pan.baidu.com/s/1SmorIH2k4IieKULAoeHdjw) ``` yum -y install java cd /opt tar zxf apache-tomcat-7.0.61.tar.gz sh /opt/apache-tomcat-7.0.61/bin/startup.sh ``` 修改配置文件: ![3-2-9](http://pded8ke3e.bkt.clouddn.com/3-2-9.png) /etc/rc.d/init.d/nginx restart #重啟nginx 多點反向代理配置: 已同樣的方法在另外一個節點(192.168.0.21)安裝tomcat 修改配置文件: ![3-2-10](http://pded8ke3e.bkt.clouddn.com/3-2-10.png) /etc/rc.d/init.d/nginx restart #重啟nginx 修改網頁內容 ``` [root@tengine-1 ]# cd /opt/apache-tomcat-7.0.61/webapps/ROOT/ [root@tengine-1 ]# echo "192.168.0.19~~~tomcat-111111" > index.jsp ``` ``` [root@tengine-2 ]# cd /opt/apache-tomcat-7.0.61/webapps/ROOT/ [root@tengine-2 ]# echo "192.168.0.21~~~tomcat-222222" > index.jsp ``` 修改后分別在兩臺機子上重啟tomcat ``` sh /opt/apache-tomcat-7.0.61/bin/shutdown.sh sh /opt/apache-tomcat-7.0.61/bin/startup.sh ``` 前端訪問: ![3-2-11](http://pded8ke3e.bkt.clouddn.com/3-2-11.png) ![3-2-12](http://pded8ke3e.bkt.clouddn.com/3-2-12.png) ## ngx_http_upstream_module 這是tengine新添加的健康檢查模塊 在nginx.conf添加如下配置: check interval=3000 rise=2 fall=5 timeout=1000 type=http; check_http_send "HEAD / HTTP/1.0\r\n\r\n"; check_http_expect_alive http_2xx http_3xx; ![3-2-13](http://pded8ke3e.bkt.clouddn.com/3-2-13.png) etc/rc.d/init.d/nginx restart #重啟nginx 前端頁面查看 ![3-2-14](http://pded8ke3e.bkt.clouddn.com/3-2-14.png) 關閉tengine-2 ![3-2-15](http://pded8ke3e.bkt.clouddn.com/3-2-15.png) 前端監控到主機掉線,啟動tengine-2后前端監控將恢復正常。
                  <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>

                              哎呀哎呀视频在线观看