一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

云服務器|WEB服務器|FTP服務器|郵件服務器|虛擬主機|服務器安全|DNS服務器|服務器知識|Nginx|IIS|Tomcat|

服務器之家 - 服務器技術 - Nginx - nginx參數的詳細介紹

nginx參數的詳細介紹

2019-11-28 14:43lqh Nginx

這篇文章主要介紹了nginx參數的詳細介紹的相關資料,需要的朋友可以參考下

nginx參數的詳細介紹

          最近公司的項目中涉及到舊老項目遷移,需要在nginx上做些配置,所以簡單學習了下,好記性不如爛筆頭,也許可以幫助到大家,

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#開啟進程數 <=CPU數
worker_processes 1;
 
#錯誤日志保存位置
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
 
#進程號保存文件
#pid logs/nginx.pid;
 
#等待事件
events {
  #每個進程最大連接數(最大連接=連接數x進程數) 
  worker_connections 1024;
}
 
http {
  #文件擴展名與文件類型映射表
  include mime.types;
   
  #默認文件類型
  default_type application/octet-stream;
   
  #日志文件輸出格式 這個位置相于全局設置
  #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  # '$status $body_bytes_sent "$http_referer" '
  # '"$http_user_agent" "$http_x_forwarded_for"';
   
  #請求日志保存位置
  #access_log logs/access.log main;
   
  #打開發送文件
  sendfile on;
  #tcp_nopush on;
   
  #連接超時時間
  #keepalive_timeout 0;
  keepalive_timeout 65;
   
  #打開gzip壓縮
  #gzip on;
   
  #設定請求緩沖
  client_header_buffer_size 1k;
  large_client_header_buffers 4 4k;
   
  #設定負載均衡的服務器列表
  upstream tomcat-servers {
    #weigth參數表示權值,權值越高被分配到的幾率越大
    #max_fails 當有#max_fails個請求失敗,就表示后端的服務器不可用,默認為1,將其設置為0可以關閉檢查
    #fail_timeout 在以后的#fail_timeout時間內nginx不會再把請求發往已檢查出標記為不可用的服務器
    #這里指定多個源服務器,ip:端口,80端口的話可寫可不寫
    server 127.0.0.1:8080 weight=5 max_fails=2 fail_timeout=600s;
    #server 127.0.0.2:8080 weight=3 max_fails=2 fail_timeout=600s; 
  }
   
  #第一個虛擬主機
  server {
  #監聽IP端口
  listen 80;
   
  #主機名
  server_name localhost;
   
  #設置字符集
  #charset koi8-r;
   
  #本虛擬server的訪問日志 相當于局部變量
  #access_log logs/host.access.log main; 
   
  #對本server"/"啟用負載均衡
  location / { 
    #root /root; #定義服務器的默認網站根目錄位置
    #index index.php index.html index.htm; #定義首頁索引文件的名稱
    proxy_pass http://tomcat-servers; #請求轉向tomcat-servers定義的服務器列表
     
    #以下是一些反向代理的配置可刪除.
    # proxy_redirect off; 
    # proxy_set_header Host $host; 
    # proxy_set_header X-Real-IP $remote_addr; 
    # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    # client_max_body_size 10m; #允許客戶端請求的最大單文件字節數 
    # client_body_buffer_size 128k; #緩沖區代理緩沖用戶端請求的最大字節數, 
    # proxy_connect_timeout 90; #nginx跟后端服務器連接超時時間(代理連接超時) 
    # proxy_send_timeout 90; #后端服務器數據回傳時間(代理發送超時) 
    # proxy_read_timeout 90; #連接成功后,后端服務器響應時間(代理接收超時) 
    # proxy_buffer_size 4k; #設置代理服務器(nginx)保存用戶頭信息的緩沖區大小 
    # proxy_buffers 4 32k; #proxy_buffers緩沖區,網頁平均在32k以下的話,這樣設置 
    # proxy_busy_buffers_size 64k; #高負荷下緩沖大?。╬roxy_buffers*2) 
    # proxy_temp_file_write_size 64k; #設定緩存文件夾大小,大于這個值,將從upstream服務器傳
  }
  location /upload
    alias e:/upload
  }
  #設定查看Nginx狀態的地址 
  location /NginxStatus
    stub_status on; 
    access_log off; 
    #allow 192.168.0.3;
    #deny all;
    #auth_basic "NginxStatus"; 
    #auth_basic_user_file conf/htpasswd; 
  }
   
  #error_page 404 /404.html;
   
  # redirect server error pages to the static page /50x.html
  # 定義錯誤提示頁面
  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
    root html;
  }
   
   
  # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  #
  #location ~ \.php$ {
    # proxy_pass http://127.0.0.1;
  #}
   
  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  #
  #location ~ \.php$ {
    # root html;
    # fastcgi_pass 127.0.0.1:9000;
    # fastcgi_index index.php;
    # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
    # include fastcgi_params;
  #}
   
  # deny access to .htaccess files, if Apache's document root
  # concurs with nginx's one
  #
  #location ~ /\.ht {
    # deny all;
  #}
  
   
   
  # another virtual host using mix of IP-, name-, and port-based configuration
  #
  #server {
    #多監聽 
    # listen 8000;
    #主機名
    # listen somename:8080;
    # server_name somename alias another.alias;
     
    # location / {
      #WEB文件路徑
      # root html;
      #默認首頁
      # index index.html index.htm;
    # }
  #}
   
   
  # HTTPS server HTTPS SSL加密服務器
  #
  #server {
    # listen 443;
    # server_name localhost;
     
    # ssl on;
    # ssl_certificate cert.pem;
    # ssl_certificate_key cert.key;
     
    # ssl_session_timeout 5m;
     
    # ssl_protocols SSLv2 SSLv3 TLSv1;
    # ssl_ciphers HIGH:!aNULL:!MD5;
    # ssl_prefer_server_ciphers on;
     
    # location / {
      # root html;
      # index index.html index.htm;
    # }
  #} 
}

 感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

原文鏈接:http://www.cnblogs.com/Dylansuns/p/6671160.html

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 99精品国产成人一区二区在线 | 99爱在线观看精品视频 | 久9视频这里只有精品123 | 成在线人免费视频一区二区三区 | 91免费精品国自产拍在线可以看 | 久久精品国产只有精品 | 俄罗斯一级大片 | 九九热只有精品 | 日韩在线视频免费不卡一区 | 粉嫩高中生第一次不戴套 | 青青青在线视频播放 | 日韩在线一区二区三区免费视频 | 国产欧美精品一区二区三区 | 成人免费播放器 | 久久热这里面只有精品 | 日本中文字幕一区二区高清在线 | 国产综合久久久久 | 国产伦精品一区二区 | 爽爽窝窝午夜精品一区二区 | 黑人video粗暴日本 | 日韩一本在线 | 波多野结衣在线观看中文字幕 | 性生大片免费看 | 天堂网站天堂小说 | 免费看一级 | 国产91成人精品亚洲精品 | 久久久无码精品亚洲A片猫咪 | 久久久久久免费高清电影 | 女同学用白丝脚玩我的故事 | 日产精品视频 | 无人区在线观看免费观看 | 痴mu动漫成年动漫在线观看 | 国产欧美二区三区 | wankz视频| 免费观看欧美成人h | 久久er99热精品一区二区 | 91天堂国产在线 在线播放 | 性生大片免费看 | 色综合九九 | 欧美精品亚洲精品日韩1818 | 11 13加污女qq看他下面 |