1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      Nginx連接超時(shí)怎么辦,進(jìn)程管理優(yōu)化助您化解

      下文給大家?guī)鞱ginx連接超時(shí)怎么辦,進(jìn)程管理優(yōu)化助您化解,希望能夠給大家在實(shí)際運(yùn)用中帶來一定的幫助,負(fù)載均衡涉及的東西比較多,理論也不多,網(wǎng)上有很多書籍,今天我們就用創(chuàng)新互聯(lián)在行業(yè)內(nèi)累計(jì)的經(jīng)驗(yàn)來做一個(gè)解答。

      10年的大慶網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。營銷型網(wǎng)站建設(shè)的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整大慶建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)公司從事“大慶網(wǎng)站設(shè)計(jì)”,“大慶網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。

      Nginx之連接超時(shí)

      在企業(yè)網(wǎng)站中,為了避免同一個(gè)客戶長時(shí)間占用連接,造成資源浪費(fèi)
      可設(shè)置相應(yīng)的連接超時(shí)參數(shù),實(shí)現(xiàn)控制連接訪問時(shí)間

      Nginx連接超時(shí)怎么辦,進(jìn)程管理優(yōu)化助您化解
      配置nginx
      [root@localhost ~]# yum install pcre-devel zlib-devel gcc gcc-c++ -y ##安裝環(huán)境包
      
      [root@localhost ~]# useradd -M -s /sbin/nologin nginx  ##創(chuàng)建程序性用戶
      
      [root@localhost ~]# mkdir /chen  ##創(chuàng)建掛載點(diǎn)
      [root@localhost ~]# mount.cifs //192.168.100.23/LNMP /chen  ##掛載
      Password for root@//192.168.100.23/LNMP:  
      
      [root@localhost chen]# tar zxvf nginx-1.12.2.tar.gz -C /opt/  ##解壓
      
      [root@localhost chen]# cd /opt/
      [root@localhost opt]# ls
      nginx-1.12.2  rh
      [root@localhost opt]# cd nginx-1.12.2/
      [root@localhost nginx-1.12.2]# ls
      auto     CHANGES.ru  configure  html     man     src
      CHANGES  conf        contrib    LICENSE  README
      
      ./configure \  ##安裝nginx組件
      --prefix=/usr/local/nginx \
      --user=nginx \
      --group=nginx \
      --with-http_stub_status_module
      
      [root@localhost nginx-1.12.2]# make && make install ##編譯
      
      [root@localhost nginx-1.12.2]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/ ##做軟鏈接讓系統(tǒng)能識(shí)別nginx的所有人命令
      [root@localhost nginx-1.12.2]# nginx -t  ##檢查語法錯(cuò)誤
      nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
      nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
      寫nginx腳本放在系統(tǒng)啟動(dòng)腳本中方便service管理器管理
      [root@localhost nginx-1.12.2]# cd /etc/init.d/ ##到系統(tǒng)啟動(dòng)腳本
      
      [root@localhost init.d]# vim nginx   ##寫一個(gè)nginx腳本
      
      #!/bin/bash
      #chkconfig: - 99 20  #注釋信息
      #description: Nginx Service Control Script
      PROG="/usr/local/nginx/sbin/nginx"  #這個(gè)變量,指向我的命令文件
      PIDF="/usr/local/nginx/logs/nginx.pid"  #這個(gè)變量,指向nginx的進(jìn)程號(hào)
      case "$1" in
          start)
              $PROG                                              
              ;;
          stop)
              kill -s QUIT $(cat $PIDF) 
              ;;
          restart)                                                  
              $0 stop
              $0 start
              ;;
          reload)                                                  
              kill -s HUP $(cat $PIDF)
              ;;
          *)                                                           
                      echo "Usage: $0 {start|stop|restart|reload}"
                      exit 1
      esac
      exit 0
      
      [root@localhost init.d]# chmod +x nginx  ##給Nginx提升權(quán)限
      [root@localhost init.d]# chkconfig --add nginx  ##添加nginx
      [root@localhost init.d]# service nginx start 
      [root@localhost init.d]# netstat -ntap | grep nginx 
      tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      17544/nginx: master 
      
      [root@localhost init.d]# systemctl stop firewalld.service
      [root@localhost init.d]# setenforce 0
      配置連接超時(shí)
      修改nginx配置文件
      [root@localhost ~]# cd /usr/local/nginx/conf/
      [root@localhost conf]# vim nginx.conf
      在http協(xié)議級(jí)別區(qū)域中添加
      31     keepalive_timeout  65 180; ##65是云服務(wù)器超時(shí)時(shí)間,180是客戶端超時(shí)時(shí)間
       32     client_header_timeout 80;  ##80是網(wǎng)頁中的頭部超時(shí)時(shí)間
       33     client_body_timeout 80;  ##80是網(wǎng)頁中身體的超時(shí)時(shí)間
      [root@localhost conf]# service nginx stop
      [root@localhost conf]# service nginx start

      nginx進(jìn)程管理優(yōu)化

      查看進(jìn)程

      [root@localhost conf]# ps aux | grep nginx
      root      51524  0.0  0.0  20544   600 ?        Ss   20:05   0:00 nginx: master process /usr/local/nginx/sbin/nginx
      nginx     51525  0.0  0.0  23072  1388 ?        S    20:05   0:00 nginx: worker process
      root      51531  0.0  0.0 112728   972 pts/3    S+   20:06   0:00 grep --color=auto nginx

      master只是起到一個(gè)監(jiān)督的作用,不會(huì)去處理請(qǐng)求
      worker才是工作進(jìn)程,處理請(qǐng)求
      這邊我們只有一工作進(jìn)程,所有的請(qǐng)求都會(huì)交給它
      如果我們想優(yōu)化就要去擴(kuò)展,我們?cè)谔摂M機(jī)中,直接擴(kuò)展

      如果我們這個(gè)nginx是在阿里云上面,即可以手動(dòng)擴(kuò),也可以自動(dòng)擴(kuò),自動(dòng)擴(kuò)就要寫一個(gè)自動(dòng)編排的工具,我們需要觸發(fā)到比如CPU不足,這個(gè)時(shí)候就需要zbbix監(jiān)控。
      cpu 內(nèi)存 硬盤 網(wǎng)絡(luò)帶寬 這些叫做垂直擴(kuò)展
      服務(wù)器實(shí)例的數(shù)量 叫做水平擴(kuò)展

      [root@localhost conf]# init 0  ##關(guān)閉服務(wù)器才能擴(kuò)展

      Nginx連接超時(shí)怎么辦,進(jìn)程管理優(yōu)化助您化解

      回到服務(wù)器中修改配置文件
      [root@localhost ~]# cd /proc/ ##查看你的cpu,內(nèi)存信息
      [root@localhost proc]# ls
      1     1536  1790  305  40   526  626  717        devices      mtrr
      10    1542  18    306  41   53   628  72         diskstats    net
      100   1545  189   307  416  54   63   723        dma          pagetypeinfo
      1082  1557  19    31   417  55   630  724        driver       partitions
      1084  1562  2     319  418  558  651  73         execdomains  sched_debug
      1085  1565  20    32   42   560  652  732        fb           schedstat
      1089  1581  21    320  43   575  654  733        filesystems  scsi
      1096  1594  22    33   433  576  666  74         fs           self
      11    16    23    333  44   577  667  75         interrupts   slabinfo
      1106  1613  24    334  443  578  668  76         iomem        softirqs
      1107  1629  25    335  45   579  669  763        ioports      stat
      12    1633  26    336  450  580  671  77         irq          swaps
      1228  1637  27    337  451  581  674  78         kallsyms     sys
      126   1640  28    338  456  582  675  79         kcore        sysrq-trigger
      13    1648  288   339  47   583  679  8          keys         sysvipc
      131   1651  289   34   48   584  685  80         key-users    timer_list
      1335  1660  29    340  486  585  686  888        kmsg         timer_stats
      1337  1668  290   341  49   586  687  9          kpagecount   tty
      1338  1680  298   342  5    587  690  99         kpageflags   uptime
      136   1687  299   343  50   588  697  acpi       loadavg      version
      14    1689  3     35   51   589  698  buddyinfo  locks        vmallocinfo
      1438  1696  30    36   516  590  7    bus        mdstat       vmstat
      1449  17    300   360  52   593  700  cgroups    meminfo      zoneinfo
      1478  1739  301   37   522  6    701  cmdline    misc
      1479  1741  302   38   523  60   703  consoles   modules
      15    1749  303   39   524  61   71   cpuinfo    mounts
      1532  1768  304   4    525  62   716  crypto     mpt
      [root@localhost proc]# cat cpuinfo  ##查看CPU,有8個(gè)核心數(shù)
      processor   : 7
      vendor_id   : GenuineIntel
      cpu family  : 6
      model       : 94
      model name  : Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
      stepping    : 3
      microcode   : 0xcc
      cpu MHz     : 2591.567
      cache size  : 6144 KB
      physical id : 1
      siblings    : 4
      core id     : 3
      cpu cores   : 4
      apicid      : 7
      initial apicid  : 7
      fpu     : yes
      fpu_exception   : yes
      cpuid level : 22
      wp      : yes
      修改nginx配置文件
      [root@localhost proc]# cd /usr/local/nginx/conf/
      [root@localhost conf]# vim nginx.conf
       3 worker_processes  8;  ##第三行修改原來只有一個(gè)核心數(shù),現(xiàn)在我們改成8個(gè)
      每個(gè)核心數(shù)默認(rèn)處理1024個(gè)請(qǐng)求
      讓所有的請(qǐng)求分?jǐn)偨o這8個(gè)核心數(shù)去處理,做負(fù)載均衡
       4 worker_cpu_affinity 01 10 
      [root@localhost conf]# service nginx stop
      [root@localhost conf]# service nginx start
      [root@localhost conf]# ps aux | grep nginx ##查看進(jìn)程
      root       1951  0.0  0.0  20544   660 ?        Ss   23:24   0:00 nginx: master process /usr/local/nginx/sbin/nginx
      nginx      1952  0.0  0.0  23072  1396 ?        S    23:24   0:00 nginx: worker process
      nginx      1953  0.0  0.0  23072  1384 ?        S    23:24   0:00 nginx: worker process
      nginx      1954  0.0  0.0  23072  1388 ?        S    23:24   0:00 nginx: worker process
      nginx      1955  0.0  0.0  23072  1396 ?        S    23:24   0:00 nginx: worker process
      nginx      1956  0.0  0.0  23072  1388 ?        S    23:24   0:00 nginx: worker process
      nginx      1957  0.0  0.0  23072  1396 ?        S    23:24   0:00 nginx: worker process
      nginx      1958  0.0  0.0  23072  1396 ?        S    23:24   0:00 nginx: worker process
      nginx      1959  0.0  0.0  23072  1396 ?        S    23:24   0:00 nginx: worker process

      root       1984  0.0  0.0 112728   972 pts/0    S+   23:25   0:00 grep --color=auto nginx


       

      看了以上關(guān)于Nginx連接超時(shí)怎么辦,進(jìn)程管理優(yōu)化助您化解,如果大家還有什么地方需要了解的可以在創(chuàng)新互聯(lián)行業(yè)資訊里查找自己感興趣的或者找我們的專業(yè)技術(shù)工程師解答的,創(chuàng)新互聯(lián)技術(shù)工程師在行業(yè)內(nèi)擁有十幾年的經(jīng)驗(yàn)了。

       



      分享標(biāo)題:Nginx連接超時(shí)怎么辦,進(jìn)程管理優(yōu)化助您化解
      網(wǎng)頁鏈接:http://www.ef60e0e.cn/article/gdcodg.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        本溪| 西畴县| 甘洛县| 临沭县| 高雄市| 精河县| 凤山市| 华宁县| 德阳市| 平塘县| 玉树县| 镇赉县| 鲁山县| 富裕县| 罗甸县| 连南| 大洼县| 安新县| 周宁县| 泰宁县| 保亭| 绥化市| 武山县| 塘沽区| 通渭县| 勃利县| 封开县| 丘北县| 时尚| 社旗县| SHOW| 黑水县| 施秉县| 波密县| 游戏| 蒙山县| 阳信县| 乐安县| 宣恩县| 上杭县| 罗江县|