<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          學(xué)習(xí)Nginx這一篇就夠了

          共 42186字,需瀏覽 85分鐘

           ·

          2021-07-22 06:41

          點(diǎn)擊“程序員面試吧”,選擇“星標(biāo)??”

          下拉至文末”查看更多


          第一章:Nginx概述


          1.1、Nginx概述

          Nginx(“engine x”)是一個(gè)高性能的HTTP和反向代理服務(wù)器,特點(diǎn)是占有內(nèi)存少,并發(fā)能力強(qiáng),事實(shí)上Nginx的并發(fā)能力確實(shí)在同類型的網(wǎng)頁(yè)服務(wù)器中表現(xiàn)較好,中國(guó)大陸使用Nginx網(wǎng)站用戶有:百度、京東、新浪、網(wǎng)易、騰訊、淘寶等。

          1.2、Nginx官網(wǎng)

          官網(wǎng)地址:http://nginx.org/

          1.3、Nginx用處

          Nginx可以作為靜態(tài)頁(yè)面的Web服務(wù)器,同時(shí)還支持CGI協(xié)議的動(dòng)態(tài)語(yǔ)言,比如Perl、PHP等。但是不支持Java。Java程序只能通過與Tomcat配合完成。Nginx專為性能優(yōu)化而開發(fā),性能是其最重要的考量,實(shí)現(xiàn)上非常注重效率,能經(jīng)受高負(fù)載的考驗(yàn),有報(bào)告表明能支持高達(dá)50000個(gè)并發(fā)連接數(shù)。


          第二章:Nginx單實(shí)例安裝


          2.1、環(huán)境說明

          模擬工具:VMware-workstation-full-15.5.6-16341506.exe

          操作系統(tǒng):CentOS-6.10-x86_64-bin-DVD1.iso、純凈安裝、桌面版

          內(nèi)存大小:2GB

          連接工具:SecureCRT

          2.2、安裝依賴

          [root@caochenlei ~]# yum install -y gcc gcc-c++ make libtool wget pcre pcre-devel zlib zlib-devel openssl openssl-devel


          2.3、Nginx下載
          [root@caochenlei ~]# wget http://nginx.org/download/nginx-1.18.0.tar.gz

          2.4、Nginx解壓

          [root@caochenlei ~]# tar -zxvf nginx-1.18.0.tar.gz


          2.5、Nginx安裝

          [root@caochenlei ~]# cd nginx-1.18.0
          [root@caochenlei nginx-1.18.0]# ./configure
          [root@caochenlei nginx-1.18.0]# make && make install

          注意:安裝完成后的路徑為:/usr/local/nginx

          2.6、Nginx命令

          普通啟動(dòng)服務(wù):/usr/local/nginx/sbin/nginx

          配置文件啟動(dòng):/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

          • 暴力停止服務(wù):/usr/local/nginx/sbin/nginx -s stop

          • 優(yōu)雅停止服務(wù):/usr/local/nginx/sbin/nginx -s quit

          • 檢查配置文件:/usr/local/nginx/sbin/nginx -t

          • 重新加載配置:/usr/local/nginx/sbin/nginx -s reload

          • 查看相關(guān)進(jìn)程:ps -ef | grep nginx


          2.7、開放防火墻

          [root@caochenlei ~]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
          [root@caochenlei ~]# /etc/rc.d/init.d/iptables save
          iptables:將防火墻規(guī)則保存到 /etc/sysconfig/iptables:[確定]


          2.8、啟動(dòng)后效果


          第三章:Nginx反向代理


          3.1、概述

          Nginx不僅可以做反向代理,還能用作正向代理來進(jìn)行上網(wǎng)等功能,正向代理:如果把局域網(wǎng)外的Internet想象成一個(gè)巨大的資源庫(kù),則局域網(wǎng)中的客戶端要訪問Internet,則需要通過代理服務(wù)器來訪問,這種代理服務(wù)就稱為正向代理。對(duì)于反向代理,客戶端對(duì)代理是無感知的,因?yàn)榭蛻舳瞬恍枰魏闻渲镁涂梢栽L問,我們只需要將請(qǐng)求發(fā)送到反向代理服務(wù)器,由反向代理服務(wù)器去選擇目標(biāo)服務(wù)器獲取數(shù)據(jù)后,在返回給客戶端,此時(shí)反向代理服務(wù)器和目標(biāo)服務(wù)器對(duì)外就是一個(gè)服務(wù)器,暴露的是代理服務(wù)器地址,隱藏了真實(shí)服務(wù)器IP地址。

          3.2、配置反向代理實(shí)例1

          3.2.1、實(shí)現(xiàn)效果

          打開瀏覽器,在瀏覽器地址欄輸入地址:http://www.123.com,跳轉(zhuǎn)到Liunx系統(tǒng)Tomcat主頁(yè)面中。


          3.2.2、實(shí)現(xiàn)思路


          3.2.3、實(shí)現(xiàn)步驟

          步驟一:修改Windows中的hosts域名映射

          復(fù)制“C:\Windows\System32\drivers\etc\hosts”到桌面,右鍵記事本打開,在里邊加上以下代碼保存,然后再?gòu)?fù)制回去,不要直接修改,會(huì)不讓保存!

          #虛擬機(jī)域名       映射的網(wǎng)址
          192.168.206.128 www.123.com

          步驟二:修改Nginx中的配置文件并啟動(dòng)

          [root@caochenlei ~]# vi /usr/local/nginx/conf/nginx.conf

          server {
                  listen       80;
                  server_name  192.168.206.128;

                  #charset koi8-r;

                  #access_log  logs/host.access.log  main;

                  location / {
                      proxy_pass http:127.0.0.1:8080;
                      root   html;
                      index  index.html index.htm;
                  }

          [root@caochenlei ~]# /usr/local/nginx/sbin/nginx

          步驟三:下載Tomcat、解壓Tomcat、安裝Tomcat、啟動(dòng)Tomcat

          注意:Tomcat啟動(dòng)需要JDK,在這里我沒有安裝,使用系統(tǒng)自帶的OpenJDK Runtime Environment (rhel-2.6.14.10.el6-x86_64 u181-b00)

          下載:

          [root@caochenlei ~]# wget https://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.105/bin/apache-tomcat-7.0.105.tar.gz

          解壓:

          [root@caochenlei ~]# tar -zxvf apache-tomcat-7.0.105.tar.gz

          安裝:

          [root@caochenlei ~]# mv apache-tomcat-7.0.105 /usr/local/tomcat

          啟動(dòng):

          [root@caochenlei ~]# /usr/local/tomcat/bin/startup.sh

          添加到防火墻:

          [root@caochenlei ~]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
          [root@caochenlei ~]# /etc/rc.d/init.d/iptables save

          如果關(guān)閉請(qǐng)用:

          [root@caochenlei ~]# /usr/local/tomcat/bin/shutdown.sh


          3.2.4、關(guān)閉服務(wù)

          [root@caochenlei ~]# /usr/local/nginx/sbin/nginx -s quit
          [root@caochenlei ~]# /usr/local/tomcat/bin/shutdown.sh


          3.3、配置反向代理實(shí)例2

          3.3.1、實(shí)現(xiàn)效果

          使用Nginx反向代理,根據(jù)訪問的路徑跳轉(zhuǎn)到不同端口的服務(wù)中。


          3.3.2、實(shí)現(xiàn)思路


          3.3.3、實(shí)現(xiàn)步驟

          步驟一:修改Nginx的配置文件,然后啟動(dòng)

          [root@caochenlei ~]# vi /usr/local/nginx/conf/nginx.conf

          server {
                  listen       80;
                  server_name  192.168.206.128;

                  #charset koi8-r;

                  #access_log  logs/host.access.log  main;

                  location ~ /edu/ {
                      proxy_pass http://127.0.0.1:8080;
                  }

                  location ~ /vod/ {
                      proxy_pass http://127.0.0.1:8081;
                  }

          [root@caochenlei ~]# /usr/local/nginx/sbin/nginx

          步驟二:拷貝兩個(gè)Tomcat,將其中一個(gè)的端口信息修改為8081,開啟防火墻,然后分別啟動(dòng)這兩臺(tái)Tomcat

          解壓:

          [root@caochenlei ~]# tar -zxvf apache-tomcat-7.0.105.tar.gz
          [root@caochenlei ~]# mv apache-tomcat-7.0.105 /usr/local/tomcat1

          [root@caochenlei ~]# tar -zxvf apache-tomcat-7.0.105.tar.gz
          [root@caochenlei ~]# mv apache-tomcat-7.0.105 /usr/local/tomcat2

          刪除:

          [root@caochenlei ~]# rm -f /usr/local/tomcat2/conf/server.xml

          添加:

          [root@caochenlei ~]# vi /usr/local/tomcat2/conf/server.xml

          <?xml version='1.0' encoding='utf-8'?>
          <!--
            Licensed to the Apache Software Foundation (ASF) under one or more
            contributor license agreements.  See the NOTICE file distributed with
            this work for additional information regarding copyright ownership.
            The ASF licenses this file to You under the Apache License, Version 2.0
            (the "License"); you may not use this file except in compliance with
            the License.  You may obtain a copy of the License at
                http://www.apache.org/licenses/LICENSE-2.0
            Unless required by applicable law or agreed to in writing, software
            distributed under the License is distributed on an "AS IS" BASIS,
            WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
            See the License for the specific language governing permissions and
            limitations under the License.
          -->
          <!-- Note:  A "Server" is not itself a "Container", so you may not
               define subcomponents such as "Valves" at this level.
               Documentation at /docs/config/server.html
           -->
          <Server port="8006" shutdown="SHUTDOWN">
            <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
            <!-- Security listener. Documentation at /docs/config/listeners.html
            <Listener className="org.apache.catalina.security.SecurityListener" />
            -->
            <!--APR library loader. Documentation at /docs/apr.html -->
            <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
            <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
            <Listener className="org.apache.catalina.core.JasperListener" />
            <!-- Prevent memory leaks due to use of particular java/javax APIs-->
            <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
            <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
            <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
            <!-- Global JNDI resources
                 Documentation at /docs/jndi-resources-howto.html
            -->
            <GlobalNamingResources>
              <!-- Editable user database that can also be used by
                   UserDatabaseRealm to authenticate users
              -->
              <Resource name="UserDatabase" auth="Container"
                        type="org.apache.catalina.UserDatabase"
                        description="User database that can be updated and saved"
                        factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
                        pathname="conf/tomcat-users.xml" />
            </GlobalNamingResources>
            <!-- A "Service" is a collection of one or more "Connectors" that share
                 a single "Container" Note:  A "Service" is not itself a "Container",
                 so you may not define subcomponents such as "Valves" at this level.
                 Documentation at /docs/config/service.html
             -->
            <Service name="Catalina">
              <!--The connectors can use a shared executor, you can define one or more named thread pools-->
              <!--
              <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
                  maxThreads="150" minSpareThreads="4"/>
              -->
              <!-- A "Connector" represents an endpoint by which requests are received
                   and responses are returned. Documentation at :
                   Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
                   Java AJP  Connector: /docs/config/ajp.html
                   APR (HTTP/AJP) Connector: /docs/apr.html
                   Define a non-SSL HTTP/1.1 Connector on port 8080
              -->
              <Connector port="8081" protocol="HTTP/1.1"
                         connectionTimeout="20000"
                         redirectPort="8444" />
              <!-- A "Connector" using the shared thread pool-->
              <!--
              <Connector executor="tomcatThreadPool"
                         port="8081" protocol="HTTP/1.1"
                         connectionTimeout="20000"
                         redirectPort="8444" />
              -->
              <!-- Define an SSL HTTP/1.1 Connector on port 8443
                   This connector uses the BIO implementation that requires the JSSE
                   style configuration. When using the APR/native implementation, the
                   OpenSSL style configuration is required as described in the APR/native
                   documentation -->
              <!--
              <Connector port="8444" protocol="org.apache.coyote.http11.Http11Protocol"
                         maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
                         clientAuth="false" sslProtocol="TLS" />
              -->
              <!-- Define an AJP 1.3 Connector on port 8009 -->
              <!--
              <Connector protocol="AJP/1.3"
                         address="::1"
                         port="8010"
                         redirectPort="8444" />
              -->
              <!-- An Engine represents the entry point (within Catalina) that processes
                   every request.  The Engine implementation for Tomcat stand alone
                   analyzes the HTTP headers included with the request, and passes them
                   on to the appropriate Host (virtual host).
                   Documentation at /docs/config/engine.html -->
              <!-- You should set jvmRoute to support load-balancing via AJP ie :
              <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
              -->
              <Engine name="Catalina" defaultHost="localhost">
                <!--For clustering, please take a look at documentation at:
                    /docs/cluster-howto.html  (simple how to)
                    /docs/config/cluster.html (reference documentation) -->
                <!--
                <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
                -->
                <!-- Use the LockOutRealm to prevent attempts to guess user passwords
                     via a brute-force attack -->
                <Realm className="org.apache.catalina.realm.LockOutRealm">
                  <!-- This Realm uses the UserDatabase configured in the global JNDI
                       resources under the key "UserDatabase".  Any edits
                       that are performed against this UserDatabase are immediately
                       available for use by the Realm.  -->
                  <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                         resourceName="UserDatabase"/>
                </Realm>
                <Host name="localhost"  appBase="webapps"
                      unpackWARs="true" autoDeploy="true">
                  <!-- SingleSignOn valve, share authentication between web applications
                       Documentation at: /docs/config/valve.html -->
                  <!--
                  <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
                  -->
                  <!-- Access log processes all example.
                       Documentation at: /docs/config/valve.html
                       Note: The pattern used is equivalent to using pattern="common" -->
                  <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
                         prefix="localhost_access_log." suffix=".txt"
                         pattern="%h %l %u %t &quot;%r&quot; %s %b" />
                </Host>
              </Engine>
            </Service>
          </Server>

          開啟Tomcat2的防火墻:

          [root@caochenlei ~]# /sbin/iptables -I INPUT -p tcp --dport 8081 -j ACCEPT
          [root@caochenlei ~]# /etc/rc.d/init.d/iptables save

          在每一個(gè)Tomcat的WebApps中創(chuàng)建一個(gè)文件夾和一個(gè)a.html文件:

          [root@caochenlei ~]# mkdir -p /usr/local/tomcat1/webapps/edu
          [root@caochenlei ~]# echo "<h1>This is 8080 Port</h1>" > /usr/local/tomcat1/webapps/edu/a.html

          [root@caochenlei ~]# mkdir -p /usr/local/tomcat2/webapps/vod
          [root@caochenlei ~]# echo "<h1>This is 8081 Port</h1>" > /usr/local/tomcat2/webapps/vod/a.html

          啟動(dòng):

          [root@caochenlei ~]# /usr/local/tomcat1/bin/startup.sh
          [root@caochenlei ~]# /usr/local/tomcat2/bin/startup.sh

          步驟三:打開本機(jī)瀏覽器進(jìn)行測(cè)試

          在瀏覽器輸入:http://192.168.206.128/edu/a.html


          在瀏覽器輸入:http://192.168.206.128/vod/a.html


          3.3.4、關(guān)閉服務(wù)
          [root@caochenlei ~]# /usr/local/nginx/sbin/nginx -s quit
          [root@caochenlei ~]# /usr/local/tomcat1/bin/shutdown.sh
          [root@caochenlei ~]# /usr/local/tomcat2/bin/shutdown.sh

          3.4、location指令說明

          描述:該指令用于匹配URL。

          語(yǔ)法:


          通配符:

          • =:用于不含正則表達(dá)式的uri前,要求請(qǐng)求字符串與uri嚴(yán)格匹配,如果匹配成功,就停止繼續(xù)向下搜索并立即處理該請(qǐng)求。

          • ~:用于表示uri包含正則表達(dá)式,并且區(qū)分大小寫。

          • ~*:用于表示uri包含正則表達(dá)式,并且不區(qū)分大小寫。

          • ^~:用于不含正則表達(dá)式的uri前,要求Nginx服務(wù)器找到標(biāo)識(shí)uri和請(qǐng)求字符串匹配度最高的location后,立即使用此location處理請(qǐng)求,而不再使用location塊中的正則uri和請(qǐng)求字符串做匹配。


          注意:如果uri包含正則表達(dá)式,則必須要有~或者~*標(biāo)識(shí)。


          第四章:Nginx負(fù)載均衡


          4.1、概述

          客戶端發(fā)送多個(gè)請(qǐng)求到服務(wù)器,服務(wù)器處理請(qǐng)求,有一些可能要與數(shù)據(jù)庫(kù)進(jìn)行交互,服務(wù)器處理完畢后,再將結(jié)果返回給客戶端。

          這種架構(gòu)模式對(duì)于早期的系統(tǒng)相對(duì)單一,并發(fā)請(qǐng)求相對(duì)較少的情況下是比較適合的,成本也低。但是隨著信息數(shù)量的不斷增長(zhǎng),訪問量和數(shù)據(jù)量的飛速增長(zhǎng),以及系統(tǒng)業(yè)務(wù)的復(fù)雜度增加,這種架構(gòu)會(huì)造成服務(wù)器相應(yīng)客戶端的請(qǐng)求日益緩慢,并發(fā)量特別大的時(shí)候,還容易造成服務(wù)器直接崩潰。很明顯這是由于服務(wù)器性能的瓶頸造成的問題,那么如何解決這種情況呢?

          我們首先想到的可能是升級(jí)服務(wù)器的配置,比如提高CPU執(zhí)行頻率,加大內(nèi)存等提高機(jī)器的物理性能來解決此問題,但是我們知道摩爾定律的日益失效,硬件的性能提升已經(jīng)不能滿足日益提升的需求了。最明顯的一個(gè)例子,天貓雙十一當(dāng)天,某個(gè)熱銷商品的瞬時(shí)訪問量是極其龐大的,那么類似上面的系統(tǒng)架構(gòu),將機(jī)器都增加到現(xiàn)有的頂級(jí)物理配置,都是不能夠滿足需求的。那么怎么辦呢?

          上面的分析我們?nèi)サ袅嗽黾臃?wù)器物理配置來解決問題的辦法,也就是說縱向解決問題的辦法行不通了,那么橫向增加服務(wù)器的數(shù)量呢?這時(shí)候集群的概念產(chǎn)生了,單個(gè)服務(wù)器解決不了,我們?cè)黾臃?wù)器的數(shù)量,然后將請(qǐng)求分發(fā)到各個(gè)服務(wù)器上,將原先請(qǐng)求集中到單個(gè)服務(wù)器上的情況改為將請(qǐng)求分發(fā)到多個(gè)服務(wù)器上,將負(fù)載分發(fā)到不同的服務(wù)器,也就是我們所說的負(fù)載均衡。


          4.2、實(shí)現(xiàn)效果

          瀏覽器地址欄輸入地址:http://192.168.206.128/edu/a.html,負(fù)載均衡效果,將請(qǐng)求平均到8080和8081端口中。


          4.3、實(shí)現(xiàn)思路


          4.4、實(shí)現(xiàn)步驟

          第一步:修改Nginx的配置文件

          [root@caochenlei ~]# vi /usr/local/nginx/conf/nginx.conf

          upstream myserver {
                  server 192.168.206.128:8080;
                  server 192.168.206.128:8081;
              }

              server {
                  listen       80;
                  server_name  192.168.206.128;

                  #charset koi8-r;

                  #access_log  logs/host.access.log  main;

                  location / {
                      proxy_pass http://myserver;
                  }

          [root@caochenlei ~]# /usr/local/nginx/sbin/nginx

          第二步:在Tomcat2的webapps文件夾中,創(chuàng)建一個(gè)edu文件夾,在里邊創(chuàng)建a.html

          創(chuàng)建:

          [root@caochenlei ~]# mkdir -p /usr/local/tomcat2/webapps/edu
          [root@caochenlei ~]# echo "<h1>This is 8081 Port</h1>" > /usr/local/tomcat2/webapps/edu/a.html

          啟動(dòng):

          [root@caochenlei ~]# /usr/local/tomcat1/bin/startup.sh
          [root@caochenlei ~]# /usr/local/tomcat2/bin/startup.sh

          第三步:測(cè)試效果

          打開IE瀏覽器輸入:http://192.168.206.128/edu/a.html


          打開IE瀏覽器輸入:http://192.168.206.128/edu/a.html


          4.5、關(guān)閉服務(wù)

          [root@caochenlei ~]# /usr/local/nginx/sbin/nginx -s quit
          [root@caochenlei ~]# /usr/local/tomcat1/bin/shutdown.sh
          [root@caochenlei ~]# /usr/local/tomcat2/bin/shutdown.sh


          4.6、分配策略

          輪詢(默認(rèn)):每個(gè)請(qǐng)求按時(shí)間順序逐一分配到不同的后端服務(wù)器,如果后端服務(wù)器down掉,能自動(dòng)剔除。

          weight:weight代表權(quán)重,默認(rèn)為1,權(quán)重越高被分配的客戶端越多,weight和訪問比率成正比,用于后端服務(wù)器性能不均的情況。例如:

          ip_hash:每個(gè)請(qǐng)求按訪問IP的hash結(jié)果分配,這樣每個(gè)訪客固定訪問一個(gè)后端服務(wù)器,可以解決session的問題。例如:

          fair(第三方):按后端服務(wù)器的響應(yīng)時(shí)間來分配請(qǐng)求,響應(yīng)時(shí)間短的優(yōu)先分配。例如:


          第五章:Nginx動(dòng)靜分離


          5.1、概述

          Nginx動(dòng)靜分離簡(jiǎn)單來說就是把動(dòng)態(tài)跟靜態(tài)請(qǐng)求分開,不能理解成只是單純的把動(dòng)態(tài)頁(yè)面和靜態(tài)頁(yè)面物理分離。嚴(yán)格意義上說應(yīng)該是動(dòng)態(tài)請(qǐng)求跟靜態(tài)請(qǐng)求分開,可以理解成使用Nginx處理靜態(tài)頁(yè)面,Tomcat處理動(dòng)態(tài)頁(yè)面。動(dòng)靜分離從目前實(shí)現(xiàn)角度來講大致分為兩種,一種是純粹把靜態(tài)文件獨(dú)立成單獨(dú)的域名,放在獨(dú)立的服務(wù)器上,也是目前主流推崇的方案;另外一種方法就是動(dòng)態(tài)跟靜態(tài)文件混合在一起發(fā)布,通過Nginx來分開。

          5.2、實(shí)現(xiàn)效果

          如果不設(shè)置動(dòng)靜分離,默認(rèn)會(huì)通過Nginx的反向代理去找Tomcat對(duì)應(yīng)的資源,現(xiàn)在我們?cè)诟夸浵聞?chuàng)建一個(gè)/data/www/文件夾,里邊放上靜態(tài)資源,比如一個(gè)html頁(yè)面,在8080的那臺(tái)Tomcat的WebApps下也創(chuàng)建一個(gè)www目錄,同樣是放一個(gè)靜態(tài)資源,當(dāng)輸入這個(gè)靜態(tài)資源的請(qǐng)求時(shí),訪問到的是/data/www中的數(shù)據(jù)。


          5.3、實(shí)現(xiàn)思路


          5.4、實(shí)現(xiàn)步驟

          第一步:創(chuàng)建靜態(tài)資源文件,為了對(duì)比,Tomcat中也放一個(gè)

          [root@caochenlei ~]# mkdir -p /data/www/
          [root@caochenlei ~]# mkdir -p /usr/local/tomcat/webapps/ROOT/www
          [root@caochenlei ~]# echo "<h1>/data/www/a.html</h1>" > /data/www/a.html
          [root@caochenlei ~]# echo "<h1>/usr/local/tomcat/webapps/ROOT/www/a.html</h1>" > /usr/local/tomcat/webapps/ROOT/www/a.html

          第二步:修改Nginx的配置文件

          [root@caochenlei ~]# vi /usr/local/nginx/conf/nginx.conf

          server {
                  listen       80;
                  server_name  192.168.206.128;

                  #charset koi8-r;

                  #access_log  logs/host.access.log  main;

                  location /www/ {
                      root /data/;
                      index index.html index.htm;
                  }

          [root@caochenlei ~]# /usr/local/nginx/sbin/nginx

          第三步:?jiǎn)?dòng)Tomcat

          [root@caochenlei ~]# /usr/local/tomcat/bin/startup.sh

          第四步:?jiǎn)?dòng)瀏覽器進(jìn)行測(cè)試

          打開瀏覽器輸入:http://192.168.206.128/www/a.html


          5.5、關(guān)閉服務(wù)

          [root@caochenlei ~]# /usr/local/nginx/sbin/nginx -s quit
          [root@caochenlei ~]# /usr/local/tomcat/bin/shutdown.sh


          第六章:Nginx高可用集群


          6.1、概述

          前邊我們學(xué)習(xí)了反向代理、負(fù)載均衡、動(dòng)靜分離,但試想一下,如果Nginx掛掉了,那么服務(wù)肯定就沒有了,有沒有一種解決方案,可以保證Nginx掛掉了,服務(wù)也可以照常使用,答案肯定是有的,這就是我們接下來要學(xué)習(xí)的高可用集群,采用的是一主一備的模式,當(dāng)主節(jié)點(diǎn)Nginx掛掉,備份服務(wù)器Nginx立刻跟上,這樣就保證了服務(wù)的高可用性。

          6.2、實(shí)現(xiàn)效果

          當(dāng)主節(jié)點(diǎn)Nginx掛掉以后,服務(wù)依然可以正常使用。

          6.3、實(shí)現(xiàn)思路


          6.4、實(shí)現(xiàn)步驟

          第一步:修改主節(jié)點(diǎn)上的Nginx的配置文件

          [root@caochenlei ~]# vi /usr/local/nginx/conf/nginx.conf

          upstream myserver {
                  server 192.168.206.128:8080;
                  server 192.168.206.128:8081;
              }

              server {
                  listen       80;
                  server_name  192.168.206.128;

                  #charset koi8-r;

                  #access_log  logs/host.access.log  main;

                  location / {
                      proxy_pass http://myserver;
                  }

          [root@caochenlei ~]# /usr/local/nginx/sbin/nginx

          第二步:?jiǎn)?dòng)主節(jié)點(diǎn)上的兩臺(tái)Tomcat

          [root@caochenlei ~]# /usr/local/tomcat1/bin/startup.sh
          [root@caochenlei ~]# /usr/local/tomcat2/bin/startup.sh

          第三步:安裝主節(jié)點(diǎn)上的keepalived

          安裝keepalived:

          [root@caochenlei ~]# yum install -y keepalived

          刪除keepalived的配置文件:

          [root@caochenlei ~]# rm -f /etc/keepalived/keepalived.conf

          新增keepalived的配置文件:

          [root@caochenlei ~]# vi /etc/keepalived/keepalived.conf

          注意:一定要注意router_id、state、interface的值,我就在這里踩坑了。

          ! Configuration File for keepalived

          global_defs {
             notification_email {
               [email protected]
               [email protected]
               [email protected]
             }
             notification_email_from [email protected]
             #郵件服務(wù)器通知地址(暫不配置,默認(rèn)即可)
             smtp_server 192.168.200.1
             #郵件服務(wù)器超時(shí)時(shí)間(暫不配置,默認(rèn)即可)
             smtp_connect_timeout 30
             #當(dāng)前虛擬機(jī)的IP地址
             router_id 192.168.206.128
          }

          vrrp_script Monitor_Nginx {
           script "/etc/keepalived/nginx_check.sh"    #檢測(cè)腳本執(zhí)行的路徑
           interval 2                                 #檢測(cè)腳本執(zhí)行的間隔
           weight 2                                   #檢測(cè)腳本執(zhí)行的權(quán)重
          }

          vrrp_instance VI_1 {
              state MASTER         #標(biāo)識(shí)這個(gè)機(jī)器是MASTER還是BACKUP
              interface eth0       #當(dāng)前機(jī)器的網(wǎng)卡名稱  
              virtual_router_id 51 #虛擬路由的編號(hào),主備必須一致
              priority 100         #主、備機(jī)取不同的優(yōu)先級(jí),主機(jī)值較大,備份機(jī)值較小
              advert_int 1         #(VRRP Multicast廣播周期秒數(shù))
              authentication {
                  auth_type PASS   #(VRRP認(rèn)證方式)
                  auth_pass 1111   #(密碼)
              }
              track_script {
            Monitor_Nginx #(調(diào)用Nginx進(jìn)程檢測(cè)腳本)
           }
              virtual_ipaddress {
                  192.168.206.50  #虛擬IP地址
              }
          }

          新增keepalived的檢測(cè)腳本:

          [root@caochenlei ~]# vi /etc/keepalived/nginx_check.sh

          #!/bin/bash
          if [ "$(ps -ef | grep "nginx: master process" | grep -v grep )" == "" ]
           then
           killall keepalived
          fi

          啟動(dòng)keepalived服務(wù):

          [root@caochenlei ~]# service keepalived start

          第四步:準(zhǔn)備一臺(tái)全新的虛擬機(jī),安裝Nginx和keepalived

          啟動(dòng)虛擬機(jī):


          安裝Nginx依賴:

          [root@caochenlei ~]# yum install -y gcc gcc-c++ make libtool wget pcre pcre-devel zlib zlib-devel openssl openssl-devel

          下載Nginx文件:

          [root@caochenlei ~]# wget http://nginx.org/download/nginx-1.18.0.tar.gz

          安裝Nginx程序:

          [root@caochenlei ~]# tar -zxvf nginx-1.18.0.tar.gz
          [root@caochenlei ~]# cd nginx-1.18.0
          [root@caochenlei nginx-1.18.0]# ./configure
          [root@caochenlei nginx-1.18.0]# make && make install
          [root@caochenlei nginx-1.18.0]# cd ~

          開放Nginx防火墻:

          [root@caochenlei ~]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
          [root@caochenlei ~]# /etc/rc.d/init.d/iptables save
          iptables:將防火墻規(guī)則保存到 /etc/sysconfig/iptables:     [確定]

          修改Nginx的配置:

          [root@caochenlei ~]# vi /usr/local/nginx/conf/nginx.conf

          upstream myserver {
                  server 192.168.206.128:8080;
                  server 192.168.206.128:8081;
              }

              server {
                  listen       80;
                  server_name  192.168.206.128;

                  #charset koi8-r;

                  #access_log  logs/host.access.log  main;

                  location / {
                      proxy_pass http://myserver;
                  }

          啟動(dòng)Nginx的服務(wù):

          [root@caochenlei ~]# /usr/local/nginx/sbin/nginx

          安裝keepalived:

          [root@caochenlei ~]# yum install -y keepalived

          刪除keepalived的配置文件:

          [root@caochenlei ~]# rm -f /etc/keepalived/keepalived.conf

          新增keepalived的配置文件:

          [root@caochenlei ~]# vi /etc/keepalived/keepalived.conf

          注意:一定要注意router_id、state、interface的值,我就在這里踩坑了。

          ! Configuration File for keepalived

          global_defs {
             notification_email {
               [email protected]
               [email protected]
               [email protected]
             }
             notification_email_from [email protected]
             #郵件服務(wù)器通知地址(暫不配置,默認(rèn)即可)
             smtp_server 192.168.200.1
             #郵件服務(wù)器超時(shí)時(shí)間(暫不配置,默認(rèn)即可)
             smtp_connect_timeout 30
             #當(dāng)前虛擬機(jī)的IP地址
             router_id 192.168.206.129
          }

          vrrp_script Monitor_Nginx {
           script "/etc/keepalived/nginx_check.sh"    #檢測(cè)腳本執(zhí)行的路徑
           interval 2                                 #檢測(cè)腳本執(zhí)行的間隔
           weight 2                                   #檢測(cè)腳本執(zhí)行的權(quán)重
          }

          vrrp_instance VI_1 {
              state BACKUP         #標(biāo)識(shí)這個(gè)機(jī)器是MASTER還是BACKUP
              interface eth1       #當(dāng)前機(jī)器的網(wǎng)卡名稱  
              virtual_router_id 51 #虛擬路由的編號(hào),主備必須一致
              priority 10          #主、備機(jī)取不同的優(yōu)先級(jí),主機(jī)值較大,備份機(jī)值較小
              advert_int 1         #(VRRP Multicast廣播周期秒數(shù))
              authentication {
                  auth_type PASS   #(VRRP認(rèn)證方式)
                  auth_pass 1111   #(密碼)
              }
              track_script {
            Monitor_Nginx    #(調(diào)用Nginx進(jìn)程檢測(cè)腳本)
           }
              virtual_ipaddress {
                  192.168.206.50   #虛擬IP地址
              }
          }

          新增keepalived的檢測(cè)腳本:
          [root@caochenlei ~]# vi /etc/keepalived/nginx_check.sh
          #!/bin/bash
          if [ "$(ps -ef | grep "nginx: master process" | grep -v grep )" == "" ]
           then
           killall keepalived
          fi
          啟動(dòng)keepalived服務(wù):

          [root@caochenlei ~]# service keepalived start

          第五步:測(cè)試兩個(gè)Nginx是否能正確的將請(qǐng)求分發(fā)到不同的Tomcat(負(fù)載均衡)

          打開IE瀏覽器輸入:http://192.168.206.128/edu/a.html


          按住F5多刷新兩遍,看看會(huì)不會(huì),將請(qǐng)求轉(zhuǎn)發(fā)到Tomcat2中去。


          打開IE瀏覽器輸入:http://192.168.206.129/edu/a.html


          按住F5多刷新兩遍,看看會(huì)不會(huì),將請(qǐng)求轉(zhuǎn)發(fā)到Tomcat2中去。


          打開IE瀏覽器輸入:http://192.168.206.50/edu/a.html,測(cè)試虛擬IP能不能實(shí)現(xiàn)負(fù)載均衡。


          按住F5多刷新兩遍,看看會(huì)不會(huì),將請(qǐng)求轉(zhuǎn)發(fā)到Tomcat2中去。


          經(jīng)過測(cè)試,我們發(fā)現(xiàn)一主一從、虛擬IP都能正常的進(jìn)行負(fù)載均衡,接下來我們測(cè)試主節(jié)點(diǎn)掛掉,從節(jié)點(diǎn)會(huì)不會(huì)自動(dòng)頂上,打開主節(jié)點(diǎn)機(jī)器,查看相關(guān)進(jìn)程,殺死Nginx,然后打開瀏覽器,輸入配置的虛擬IP地址:http://192.168.206.50/edu/a.html,發(fā)現(xiàn)負(fù)載均衡的效果還在,說明配置成功了。


          6.5、關(guān)閉服務(wù)

          主機(jī)節(jié)點(diǎn):

          [root@caochenlei ~]# service keepalived stop
          [root@caochenlei ~]# /usr/local/nginx/sbin/nginx -s quit
          [root@caochenlei ~]# /usr/local/tomcat1/bin/shutdown.sh
          [root@caochenlei ~]# /usr/local/tomcat2/bin/shutdown.sh

          備份節(jié)點(diǎn):

          [root@caochenlei ~]# service keepalived stop
          [root@caochenlei ~]# /usr/local/nginx/sbin/nginx -s quit


          第七章:Nginx配置詳解


          Nginx是通過配置文件來做到各個(gè)功能的實(shí)現(xiàn)的。Nginx的配置文件的格式非常合乎邏輯,學(xué)習(xí)這種格式以及如何使用這種每個(gè)部分是基礎(chǔ),這將幫助我們有可能手工創(chuàng)建一個(gè)配置文件。

          7.1、整體結(jié)構(gòu)圖


          7.2、配置演示圖


          7.3、全局塊

          配置影響Nginx全局的指令。主要包括:

          • 配置運(yùn)行Nginx服務(wù)器用戶(組)

          • worker process數(shù)

          • Nginx進(jìn)程

          • PID存放路徑錯(cuò)誤日志的存放路徑

          • 一個(gè)Nginx進(jìn)程打開的最多文件描述符數(shù)目


          例如:

          #配置worker進(jìn)程運(yùn)行用戶(和用戶組),nobody也是一個(gè)Linux用戶,一般用于啟動(dòng)程序,沒有密碼
          user nobody;
          #user www www;

          #配置工作進(jìn)程數(shù)目,根據(jù)硬件調(diào)整,通常等于CPU數(shù)量或者2倍于CPU數(shù)量
          worker_processes 1;

          #配置全局錯(cuò)誤日志及類型,[debug | info | notice | warn | error | crit],默認(rèn)是error
          error_log logs/error.log;
          #error_log logs/error.log notice;
          #error_log logs/error.log info;

          #配置進(jìn)程pid文件
          pid logs/nginx.pid;

          #一個(gè)nginx進(jìn)程打開的最多文件描述符數(shù)目,理論值應(yīng)該是最多打開文件數(shù)(系統(tǒng)的值ulimit -n)與Nginx進(jìn)程數(shù)相除,但是Nginx分配請(qǐng)求并不均勻,所以建議與ulimit -n的值保持一致。
          worker_rlimit_nofile 65535;


          7.4、events塊

          配置影響Nginx服務(wù)器或與用戶的網(wǎng)絡(luò)連接。主要包括:

          • 事件驅(qū)動(dòng)模型的選擇

          • 最大連接數(shù)的配置


          例如:

          #參考事件模型,use [ kqueue | rtsig | epoll | /dev/poll | select | poll ]; 
          #epoll模型是Linux 2.6以上版本內(nèi)核中的高性能網(wǎng)絡(luò)I/O模型,如果跑在FreeBSD上面,就用kqueue模型。
          use epoll;

          #單個(gè)進(jìn)程最大連接數(shù)(最大連接數(shù)=連接數(shù)*進(jìn)程數(shù))
          worker_connections 65535;


          7.5、http塊

          可以嵌套多個(gè)server,配置代理,緩存,日志定義等絕大多數(shù)功能和第三方模塊的配置。主要包括:

          • 定義MIMI-Type

          • 自定義服務(wù)日志

          • 允許sendfile方式傳輸文件

          • 連接超時(shí)時(shí)間

          • 單連接請(qǐng)求數(shù)上限


          例如:

          #常見的一些基礎(chǔ)配置
          include mime.types; #文件擴(kuò)展名與文件類型映射表
          default_type application/octet-stream; #默認(rèn)文件類型
          charset utf-8; #默認(rèn)編碼
          server_names_hash_bucket_size 128; #服務(wù)器名字的hash表大小
          client_header_buffer_size 32k; #上傳文件大小限制
          large_client_header_buffers 4 64k; #設(shè)定請(qǐng)求緩沖
          client_max_body_size 8m; #設(shè)定請(qǐng)求緩沖
          sendfile on; #開啟高效文件傳輸模式,對(duì)于普通應(yīng)用設(shè)為on,如果用來進(jìn)行下載等應(yīng)用磁盤IO重負(fù)載應(yīng)用,可設(shè)置為off,以平衡磁盤與網(wǎng)絡(luò)I/O處理速度,降低系統(tǒng)的負(fù)載。注意:如果圖片顯示不正常把這個(gè)改成off。
          autoindex on; #開啟目錄列表訪問,合適下載服務(wù)器,默認(rèn)關(guān)閉。
          tcp_nopush on; #防止網(wǎng)絡(luò)阻塞
          tcp_nodelay on; #防止網(wǎng)絡(luò)阻塞
          keepalive_timeout 120; #長(zhǎng)連接超時(shí)時(shí)間,單位是秒

          #FastCGI相關(guān)參數(shù)是為了改善網(wǎng)站的性能:減少資源占用,提高訪問速度。
          fastcgi_connect_timeout 300;
          fastcgi_send_timeout 300;
          fastcgi_read_timeout 300;
          fastcgi_buffer_size 64k;
          fastcgi_buffers 4 64k;
          fastcgi_busy_buffers_size 128k;
          fastcgi_temp_file_write_size 128k;

          #gzip模塊設(shè)置
          gzip on; #開啟gzip壓縮輸出
          gzip_min_length 1k; #最小壓縮文件大小
          gzip_buffers 4 16k; #壓縮緩沖區(qū)
          gzip_http_version 1.0; #壓縮版本(默認(rèn)1.1,前端如果是squid2.5請(qǐng)使用1.0)
          gzip_comp_level 2; #壓縮等級(jí)
          gzip_types text/plain application/x-javascript text/css application/xml; #壓縮類型
          gzip_vary on; #增加響應(yīng)頭'Vary: Accept-Encoding'
          limit_zone crawler $binary_remote_addr 10m; #開啟限制IP連接數(shù)的時(shí)候需要使用


          7.6、server塊

          配置虛擬主機(jī)的相關(guān)參數(shù),一個(gè)http中可以有多個(gè)server。主要包括:

          • 配置網(wǎng)絡(luò)監(jiān)聽

          • 配置https服務(wù)

          • 基于名稱的虛擬主機(jī)配置

          • 基于IP的虛擬主機(jī)配置


          例如:

          #虛擬主機(jī)的常見配置
          server {
              listen       80; #配置監(jiān)聽端口
              server_name  localhost; #配置服務(wù)名
              charset utf-8; #配置字符集
              access_log  logs/host.access.log  main; #配置本虛擬主機(jī)的訪問日志
              
              location / {
                  root html; #root是配置服務(wù)器的默認(rèn)網(wǎng)站根目錄位置,默認(rèn)為Nginx安裝主目錄下的html目錄
                  index index.html index.htm; #配置首頁(yè)文件的名稱
              }
              
              error_page 404             /404.html; #配置404錯(cuò)誤頁(yè)面
              error_page 500 502 503 504 /50x.html; #配置50x錯(cuò)誤頁(yè)面
          }

          #配置https服務(wù),安全的網(wǎng)絡(luò)傳輸協(xié)議,加密傳輸,端口443
          server {
              listen       443 ssl;
              server_name  localhost;

              ssl_certificate      cert.pem;
              ssl_certificate_key  cert.key;

              ssl_session_cache    shared:SSL:1m;
              ssl_session_timeout  5m;

              ssl_ciphers  HIGH:!aNULL:!MD5;
              ssl_prefer_server_ciphers  on;

              location / {
                  root   html;
                  index  index.html index.htm;
              }
          }


          7.7、location塊

          配置請(qǐng)求的路由,以及各種頁(yè)面的處理情況。主要包括:

          • 請(qǐng)求根目錄配置更改

          • 網(wǎng)站默認(rèn)首頁(yè)配置

          • location的URI


          例如:

          root html; #root是配置服務(wù)器的默認(rèn)網(wǎng)站根目錄位置,默認(rèn)為Nginx安裝主目錄下的html目錄
          index index.html index.htm; #配置首頁(yè)文件的名稱

          proxy_pass http://127.0.0.1:88; #反向代理的地址
          proxy_redirect off; #是否開啟重定向
          #后端的Web服務(wù)器可以通過X-Forwarded-For獲取用戶真實(shí)IP
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $host;
          #以下是一些反向代理的配置,可選。
          client_max_body_size 10m; #允許客戶端請(qǐng)求的最大單文件字節(jié)數(shù)
          client_body_buffer_size 128k; #緩沖區(qū)代理緩沖用戶端請(qǐng)求的最大字節(jié)數(shù),
          proxy_connect_timeout 90; #nginx跟后端服務(wù)器連接超時(shí)時(shí)間(代理連接超時(shí))
          proxy_send_timeout 90; #后端服務(wù)器數(shù)據(jù)回傳時(shí)間(代理發(fā)送超時(shí))
          proxy_read_timeout 90; #連接成功后,后端服務(wù)器響應(yīng)時(shí)間(代理接收超時(shí))
          proxy_buffer_size 4k; #設(shè)置代理服務(wù)器(Nginx)保存用戶頭信息的緩沖區(qū)大小
          proxy_buffers 4 32k; #proxy_buffers緩沖區(qū),網(wǎng)頁(yè)平均在32k以下的設(shè)置
          proxy_busy_buffers_size 64k; #高負(fù)荷下緩沖大小(proxy_buffers*2)
          proxy_temp_file_write_size 64k;  #設(shè)定緩存文件夾大小

          location的URI:

          描述:該指令用于匹配URL

          語(yǔ)法:


          通配符:

          • =:用于不含正則表達(dá)式的uri前,要求請(qǐng)求字符串與uri嚴(yán)格匹配,如果匹配成功,就停止繼續(xù)向下搜索并立即處理該請(qǐng)求。

          • ~:用于表示uri包含正則表達(dá)式,并且區(qū)分大小寫。

          • ~*:用于表示uri包含正則表達(dá)式,并且不區(qū)分大小寫。

          • ^~:用于不含正則表達(dá)式的uri前,要求Nginx服務(wù)器找到標(biāo)識(shí)uri和請(qǐng)求字符串匹配度最高的location后,立即使用此location處理請(qǐng)求,而不再使用location塊中的正則uri和請(qǐng)求字符串做匹配。


          注意:如果uri包含正則表達(dá)式,則必須要有~或者~*標(biāo)識(shí)。


          第八章:Nginx原理分析


          8.1、Nginx的線程模型?

          Nginx默認(rèn)采用多進(jìn)程工作方式,Nginx啟動(dòng)后,會(huì)運(yùn)行一個(gè)master進(jìn)程和多個(gè)worker進(jìn)程。其中master充當(dāng)整個(gè)進(jìn)程組與用戶的交互接口,同時(shí)對(duì)進(jìn)程進(jìn)行監(jiān)護(hù),管理worker進(jìn)程來實(shí)現(xiàn)重啟服務(wù)、平滑升級(jí)、更換日志文件、配置文件實(shí)時(shí)生效等功能。worker用來處理基本的網(wǎng)絡(luò)事件,worker之間是平等的,他們共同競(jìng)爭(zhēng)來處理來自客戶端的請(qǐng)求。

          Nginx的進(jìn)程模型如圖所示:


          8.2、worker的工作模式?

          worker對(duì)于連接是采用爭(zhēng)搶的模式,誰先搶到就先交給誰處理,如果想要重新更新配置,由于已經(jīng)搶到任務(wù)的worker不會(huì)參與爭(zhēng)搶,那些空閑的worker就會(huì)去爭(zhēng)搶連接,拿到連接后會(huì)自動(dòng)更新配置信息,當(dāng)那些有任務(wù)的worker完成任務(wù)后,會(huì)自動(dòng)更新配置,這樣就實(shí)現(xiàn)了無縫熱部署。由于每個(gè)worker是獨(dú)立的進(jìn)程,如果有其中的一個(gè)worker出現(xiàn)問題,并不會(huì)影響其它worker繼續(xù)進(jìn)行爭(zhēng)搶,在實(shí)現(xiàn)請(qǐng)求的過程,不會(huì)造成服務(wù)中斷,建議worker數(shù)和服務(wù)器的CPU數(shù)相等是最為適宜的。


          8.3、如何計(jì)算worker連接數(shù)?

          如果只訪問Nginx的靜態(tài)資源,一個(gè)發(fā)送請(qǐng)求會(huì)占用了woker的2個(gè)連接數(shù)
          而如果是作為反向代理服務(wù)器,一個(gè)發(fā)送請(qǐng)求會(huì)占用了woker的4個(gè)連接數(shù)

          8.4、如何計(jì)算最大的并發(fā)數(shù)?

          如果只訪問nginx的靜態(tài)資源,最大并發(fā)數(shù)量應(yīng)該是:worker_connections * worker_processes / 2

          而如果是作為反向代理服務(wù)器,最大并發(fā)數(shù)量應(yīng)該是:worker_connections * worker_processes / 4

          原文鏈接:https://blog.csdn.net/qq_38490457/article/details/108300342
          轉(zhuǎn)自:分布式實(shí)驗(yàn)室


          瀏覽 78
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  黄色免费一级在线视频 | 一级A爱爱 | 亚洲第一色播 | 亚洲秘 无码一区二区三区电影 | 18禁精品|