1. 程式人生 > 遊戲攻略 >《彩虹六號異種》幹員減傷數值一覽

《彩虹六號異種》幹員減傷數值一覽

序言

Nginx是lgor Sysoev為俄羅斯訪問量第二的rambler.ru站點設計開發的。從2004年釋出至今,憑藉開源的力量,已經接近成熟與完善。

Nginx功能豐富,可作為HTTP伺服器,也可作為反向代理伺服器,郵件伺服器。支援FastCGI、SSL、Virtual Host、URL Rewrite、Gzip等功能。並且支援很多第三方的模組擴充套件。

Nginx的穩定性、功能集、示例配置檔案和低系統資源的消耗讓他後來居上,在全球活躍的網站中有12.18%的使用比率,大約為2220萬個網站。

牛逼吹的差不多啦,如果你還不過癮,你可以百度百科或者一些書上找到這樣的誇耀,比比皆是。

Nginx常用功能

1、Http代理,反向代理:作為web伺服器最常用的功能之一,尤其是反向代理。

這裡我給來2張圖,對正向代理與反響代理做個詮釋,具體細節,大家可以翻閱下資料。

Nginx在做反向代理時,提供效能穩定,並且能夠提供配置靈活的轉發功能。Nginx可以根據不同的正則匹配,採取不同的轉發策略,比如圖片檔案結尾的走檔案伺服器,動態頁面走web伺服器,只要你正則寫的沒問題,又有相對應的伺服器解決方案,你就可以隨心所欲的玩。並且Nginx對返回結果進行錯誤頁跳轉,異常判斷等。如果被分發的伺服器存在異常,他可以將請求重新轉發給另外一臺伺服器,然後自動去除異常伺服器。

2、負載均衡

Nginx提供的負載均衡策略有2種:內建策略和擴充套件策略。內建策略為輪詢,加權輪詢,Ip hash。擴充套件策略,就天馬行空,只有你想不到的沒有他做不到的啦,你可以參照所有的負載均衡演算法,給他一一找出來做下實現。

上3個圖,理解這三種負載均衡演算法的實現

Ip hash演算法,對客戶端請求的ip進行hash操作,然後根據hash結果將同一個客戶端ip的請求分發給同一臺伺服器進行處理,可以解決session不共享的問題。

3、web快取

Nginx可以對不同的檔案做不同的快取處理,配置靈活,並且支援FastCGI_Cache,主要用於對FastCGI的動態程式進行快取。配合著第三方的ngx_cache_purge,對制定的URL快取內容可以的進行增刪管理。

4、Nginx相關地址

原始碼:https://trac.nginx.org/nginx/browser

官網:http://www.nginx.org/

Nginx配置檔案結構

如果你下載好啦,你的安裝檔案,不妨開啟conf資料夾的nginx.conf檔案,Nginx伺服器的基礎配置,預設的配置也存放在此。

在nginx.conf的註釋符號位#

nginx檔案的結構,這個對剛入門的同學,可以多看兩眼。

預設的config

  1 #user  nobody;
  2 worker_processes  1;
  3 
  4 #error_log  logs/error.log;
  5 #error_log  logs/error.log  notice;
  6 #error_log  logs/error.log  info;
  7 
  8 #pid        logs/nginx.pid;
  9 
 10 
 11 events {
 12     worker_connections  1024;
 13 }
 14 
 15 
 16 http {
 17     include       mime.types;
 18     default_type  application/octet-stream;
 19 
 20     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
 21     #                  '$status $body_bytes_sent "$http_referer" '
 22     #                  '"$http_user_agent" "$http_x_forwarded_for"';
 23 
 24     #access_log  logs/access.log  main;
 25 
 26     sendfile        on;
 27     #tcp_nopush     on;
 28 
 29     #keepalive_timeout  0;
 30     keepalive_timeout  65;
 31 
 32     #gzip  on;
 33 
 34     server {
 35         listen       80;
 36         server_name  localhost;
 37 
 38         #charset koi8-r;
 39 
 40         #access_log  logs/host.access.log  main;
 41 
 42         location / {
 43             root   html;
 44             index  index.html index.htm;
 45         }
 46 
 47         #error_page  404              /404.html;
 48 
 49         # redirect server error pages to the static page /50x.html
 50         #
 51         error_page   500 502 503 504  /50x.html;
 52         location = /50x.html {
 53             root   html;
 54         }
 55 
 56         # proxy the PHP scripts to Apache listening on 127.0.0.1:80
 57         #
 58         #location ~ \.php$ {
 59         #    proxy_pass   http://127.0.0.1;
 60         #}
 61 
 62         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 63         #
 64         #location ~ \.php$ {
 65         #    root           html;
 66         #    fastcgi_pass   127.0.0.1:9000;
 67         #    fastcgi_index  index.php;
 68         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
 69         #    include        fastcgi_params;
 70         #}
 71 
 72         # deny access to .htaccess files, if Apache's document root
 73         # concurs with nginx's one
 74         #
 75         #location ~ /\.ht {
 76         #    deny  all;
 77         #}
 78     }
 79 
 80 
 81     # another virtual host using mix of IP-, name-, and port-based configuration
 82     #
 83     #server {
 84     #    listen       8000;
 85     #    listen       somename:8080;
 86     #    server_name  somename  alias  another.alias;
 87 
 88     #    location / {
 89     #        root   html;
 90     #        index  index.html index.htm;
 91     #    }
 92     #}
 93 
 94 
 95     # HTTPS server
 96     #
 97     #server {
 98     #    listen       443 ssl;
 99     #    server_name  localhost;
100 
101     #    ssl_certificate      cert.pem;
102     #    ssl_certificate_key  cert.key;
103 
104     #    ssl_session_cache    shared:SSL:1m;
105     #    ssl_session_timeout  5m;
106 
107     #    ssl_ciphers  HIGH:!aNULL:!MD5;
108     #    ssl_prefer_server_ciphers  on;
109 
110     #    location / {
111     #        root   html;
112     #        index  index.html index.htm;
113     #    }
114     #}
115 
116 }

nginx檔案結構

...              #全域性塊

events {         #events塊
   ...
}

http      #http塊
{
    ...   #http全域性塊
    server        #server塊
    { 
        ...       #server全域性塊
        location [PATTERN]   #location塊
        {
            ...
        }
        location [PATTERN] 
        {
            ...
        }
    }
    server
    {
      ...
    }
    ...     #http全域性塊
}

1、全域性塊:配置影響nginx全域性的指令。一般有執行nginx伺服器的使用者組,nginx程序pid存放路徑,日誌存放路徑,配置檔案引入,允許生成worker process數等。

2、events塊:配置影響nginx伺服器或與使用者的網路連線。有每個程序的最大連線數,選取哪種事件驅動模型處理連線請求,是否允許同時接受多個網路連線,開啟多個網路連線序列化等。

3、http塊:可以巢狀多個server,配置代理,快取,日誌定義等絕大多數功能和第三方模組的配置。如檔案引入,mime-type定義,日誌自定義,是否使用sendfile傳輸檔案,連線超時時間,單連線請求數等。

4、server塊:配置虛擬主機的相關引數,一個http中可以有多個server。

5、location塊:配置請求的路由,以及各種頁面的處理情況。

下面給大家上一個配置檔案,作為理解,同時也配入我搭建的一臺測試機中,給大家示例。

########### 每個指令必須有分號結束。#################
#user administrator administrators;  #配置使用者或者組,預設為nobody nobody。
#worker_processes 2;  #允許生成的程序數,預設為1
#pid /nginx/pid/nginx.pid;   #指定nginx程序執行檔案存放地址
error_log log/error.log debug;  #制定日誌路徑,級別。這個設定可以放入全域性塊,http塊,server塊,級別以此為:debug|info|notice|warn|error|crit|alert|emerg
events {
    accept_mutex on;   #設定網路連線序列化,防止驚群現象發生,預設為on
    multi_accept on;  #設定一個程序是否同時接受多個網路連線,預設為off
    #use epoll;      #事件驅動模型,select|poll|kqueue|epoll|resig|/dev/poll|eventport
    worker_connections  1024;    #最大連線數,預設為512
}
http {
    include       mime.types;   #副檔名與檔案型別對映表
    default_type  application/octet-stream; #預設檔案型別,預設為text/plain
    #access_log off; #取消服務日誌    
    log_format myFormat '$remote_addr–$remote_user [$time_local] $request $status $body_bytes_sent $http_referer $http_user_agent $http_x_forwarded_for'; #自定義格式
    access_log log/access.log myFormat;  #combined為日誌格式的預設值
    sendfile on;   #允許sendfile方式傳輸檔案,預設為off,可以在http塊,server塊,location塊。
    sendfile_max_chunk 100k;  #每個程序每次呼叫傳輸數量不能大於設定的值,預設為0,即不設上限。
    keepalive_timeout 65;  #連線超時時間,預設為75s,可以在http,server,location塊。

    upstream mysvr {   
      server 127.0.0.1:7878;
      server 192.168.10.121:3333 backup;  #熱備
    }
    error_page 404 https://www.baidu.com; #錯誤頁
    server {
        keepalive_requests 120; #單連線請求上限次數。
        listen       4545;   #監聽埠
        server_name  127.0.0.1;   #監聽地址       
        location  ~*^.+$ {       #請求的url過濾,正則匹配,~為區分大小寫,~*為不區分大小寫。
           #root path;  #根目錄
           #index vv.txt;  #設定預設頁
           proxy_pass  http://mysvr;  #請求轉向mysvr 定義的伺服器列表
           deny 127.0.0.1;  #拒絕的ip
           allow 172.18.5.54; #允許的ip           
        } 
    }
}

上面是nginx的基本配置,需要注意的有以下幾點:

1、1.$remote_addr$http_x_forwarded_for 用以記錄客戶端的ip地址;

2.$remote_user :用來記錄客戶端使用者名稱稱;

3.$time_local: 用來記錄訪問時間與時區

4.$request : 用來記錄請求的url與http協議

2、驚群現象:一個網路連線到來,多個睡眠的程序被同事叫醒,但只有一個程序能獲得連結,這樣會影響系統性能。

3、每個指令必須有分號結束。

摘自:

https://www.cnblogs.com/knowledgesea/p/5175711.html