

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# haproxy 屬性
<a name="attributes-recipes-haproxy"></a>

**重要**  
 AWS OpsWorks Stacks 此服務已於 2024 年 5 月 26 日終止，並已針對新客戶和現有客戶停用。我們強烈建議客戶盡快將其工作負載遷移至其他解決方案。如果您對遷移有任何疑問，請透過 [AWS re：Post](https://repost.aws/) 或透過 [AWS Premium Support](https://aws.amazon.com/support) 聯絡 AWS 支援 團隊。

**注意**  
這些屬性僅適用於 Linux 堆疊。

[`haproxy` 屬性](https://github.com/aws/opsworks-cookbooks/blob/release-chef-11.10/haproxy/attributes/default.rb)指定 [HAProxy 伺服器](http://haproxy.1wt.eu/)組態。如需詳細資訊，請參閱 [HAProxy 文件](http://cbonte.github.io/haproxy-dconv/configuration-1.5.html)。如需如何覆寫內建屬性以指定自訂值的詳細資訊，請參閱[覆寫屬性](workingcookbook-attributes.md)。


****  

|  |  |  | 
| --- |--- |--- |
| [balance ](#attributes-recipes-haproxy-balance) | [check\$1interval ](#attributes-recipes-haproxy-interval) | [client\$1timeout ](#attributes-recipes-haproxy-client-timeout) | 
| [connect\$1timeout ](#attributes-recipes-haproxy-connect-timeout) | [default\$1max\$1connections ](#attributes-recipes-haproxy-default-max) | [global\$1max\$1connections ](#attributes-recipes-haproxy-global-max) | 
| [health\$1check\$1method ](#attributes-recipes-haproxy-health-method) | [health\$1check\$1url ](#attributes-recipes-haproxy-health-url) | [queue\$1timeout ](#attributes-recipes-haproxy-queue-timeout) | 
| [http\$1request\$1timeout ](#attributes-recipes-haproxy-http-timeout) | [maxcon\$1factor\$1nodejs\$1app ](#attributes-recipes-haproxy-nodejs-app) | [maxcon\$1factor\$1nodejs\$1app\$1ssl ](#attributes-recipes-haproxy-nodejs-ssl) | 
| [maxcon\$1factor\$1php\$1app ](#attributes-recipes-haproxy-php-app) | [maxcon\$1factor\$1php\$1app\$1ssl ](#attributes-recipes-haproxy-php-ssl) | [maxcon\$1factor\$1rails\$1app ](#attributes-recipes-haproxy-rails-app) | 
| [maxcon\$1factor\$1rails\$1app\$1ssl ](#attributes-recipes-haproxy-rails-ssl) | [maxcon\$1factor\$1static ](#attributes-recipes-haproxy-static-app) | [maxcon\$1factor\$1static\$1ssl ](#attributes-recipes-haproxy-static-ssl) | 
| [retries ](#attributes-recipes-haproxy-retries) | [server\$1timeout ](#attributes-recipes-haproxy-server-timeout) | [stats\$1url ](#attributes-recipes-haproxy-stats-url) | 
| [stats\$1user ](#attributes-recipes-haproxy-user) |  |  | 

**balance **  <a name="attributes-recipes-haproxy-balance"></a>
負載平衡器用來選取伺服器的演算法 (字串)。預設值為 `'roundrobin'`。其他選項為：  
+ 'static-rr'
+ 'leastconn'
+ 'source'
+ 'uri'
+ 'url\$1param'
+ 'hdr(name)'
+ 'rdp-cookie'
+ 'rdp-cookie(name)'
如需這些引數的詳細資訊，請參閱 [balance](http://cbonte.github.io/haproxy-dconv/configuration-1.5.html)。  

```
node[:haproxy][:balance]
```

**check\$1interval **  <a name="attributes-recipes-haproxy-interval"></a>
運作狀態檢查時間間隔 (字串)。預設值為 `'10s'`。  

```
node[:haproxy][:check_interval]
```

**client\$1timeout **  <a name="attributes-recipes-haproxy-client-timeout"></a>
用戶端可處於非作用中狀態的時間上限 (字串)。預設值為 `'60s'`。  

```
node[:haproxy][:client_timeout]
```

**connect\$1timeout **  <a name="attributes-recipes-haproxy-connect-timeout"></a>
HAProxy 會等待伺服器連線嘗試成功的時間上限 (字串)。預設值為 `'10s'`。  

```
node[:haproxy][:connect_timeout]
```

**default\$1max\$1connections **  <a name="attributes-recipes-haproxy-default-max"></a>
預設的連線數目上限 (字串)。預設值為 `'80000'`。  

```
node[:haproxy][:default_max_connections]
```

**global\$1max\$1connections **  <a name="attributes-recipes-haproxy-global-max"></a>
連線數目上限 (字串)。預設值為 `'80000'`。  

```
node[:haproxy][:global_max_connections]
```

**health\$1check\$1method **  <a name="attributes-recipes-haproxy-health-method"></a>
運作狀態檢查方法 (字串)。預設值為 `'OPTIONS'`。  

```
node[:haproxy][:health_check_method]
```

**health\$1check\$1url **  <a name="attributes-recipes-haproxy-health-url"></a>
用來檢查伺服器運作狀態的 URL 路徑 (字串)。預設值為 `'/'`。  

```
node[:haproxy][:health_check_url ]
```

**queue\$1timeout **  <a name="attributes-recipes-haproxy-queue-timeout"></a>
可用連線的等待時間上限 (字串)。預設值為 `'120s'`。  

```
node[:haproxy][:queue_timeout]
```

**http\$1request\$1timeout **  <a name="attributes-recipes-haproxy-http-timeout"></a>
HAProxy 會等待 HTTP 請求完成的時間上限 (字串)。預設值為 `'30s'`。  

```
node[:haproxy][:http_request_timeout]
```

**retries **  <a name="attributes-recipes-haproxy-retries"></a>
伺服器連線失敗之後的重試次數 (字串)。預設值為 `'3'`。  

```
node[:haproxy][:retries]
```

**server\$1timeout **  <a name="attributes-recipes-haproxy-server-timeout"></a>
用戶端可處於非作用中狀態的時間上限 (字串)。預設值為 `'60s'`。  

```
node[:haproxy][:server_timeout]
```

**stats\$1url **  <a name="attributes-recipes-haproxy-stats-url"></a>
統計資料頁面的 URL 路徑 (字串)。預設值為 `'/haproxy?stats'`。  

```
node[:haproxy][:stats_url]
```

**stats\$1user **  <a name="attributes-recipes-haproxy-user"></a>
統計資料頁面使用者名稱 (字串)。預設值為 `'opsworks'`。  

```
node[:haproxy][:stats_user]
```

`maxcon` 屬性代表載入因數乘數，用來運算 HAProxy 允許[後端](attributes-json-opsworks-instance.md#attributes-json-opsworks-instance-backends)的連線數目上限。例如，假設您在`backend`值為 4 的小型執行個體上有一個 Rails 應用程式伺服器，這表示 OpsWorks Stacks 將為該執行個體設定四個 Rails 程序。如果您使用預設 `maxcon_factor_rails_app` 值 7，HAProxy 會處理 Rails 伺服器的 28 (4\$1 7) 個連線。

**maxcon\$1factor\$1nodejs\$1app **  <a name="attributes-recipes-haproxy-nodejs-app"></a>
Node.js 應用程式伺服器的 maxcon 因數 (數值)。預設值為 `10`。  

```
node[:haproxy][:maxcon_factor_nodejs_app]
```

**maxcon\$1factor\$1nodejs\$1app\$1ssl **  <a name="attributes-recipes-haproxy-nodejs-ssl"></a>
使用 SSL 之 Node.js 應用程式伺服器的 maxcon 因數 (數值)。預設值為 `10`。  

```
node[:haproxy][:maxcon_factor_nodejs_app_ssl]
```

**maxcon\$1factor\$1php\$1app **  <a name="attributes-recipes-haproxy-php-app"></a>
PHP 應用程式伺服器的 maxcon 因數 (數值)。預設值為 `10`。  

```
node[:haproxy][:maxcon_factor_php_app]
```

**maxcon\$1factor\$1php\$1app\$1ssl **  <a name="attributes-recipes-haproxy-php-ssl"></a>
使用 SSL 之 PHP 應用程式伺服器的 maxcon 因數 (數值)。預設值為 `10`。  

```
node[:haproxy][:maxcon_factor_php_app_ssl]
```

**maxcon\$1factor\$1rails\$1app **  <a name="attributes-recipes-haproxy-rails-app"></a>
Rails 應用程式伺服器的 maxcon 因數 (數值)。預設值為 `7`。  

```
node[:haproxy][:maxcon_factor_rails_app]
```

**maxcon\$1factor\$1rails\$1app\$1ssl **  <a name="attributes-recipes-haproxy-rails-ssl"></a>
使用 SSL 之 Rails 應用程式伺服器的 maxcon 因數 (數值)。預設值為 `7`。  

```
node[:haproxy][:maxcon_factor_rails_app_ssl]
```

**maxcon\$1factor\$1static **  <a name="attributes-recipes-haproxy-static-app"></a>
靜態 Web 伺服器的 maxcon 因數 (數值)。預設值為 `15`。  

```
node[:haproxy][:maxcon_factor_static]
```

**maxcon\$1factor\$1static\$1ssl **  <a name="attributes-recipes-haproxy-static-ssl"></a>
使用 SSL 之靜態 Web 伺服器的 maxcon 因數 (數值)。預設值為 `15`。  

```
node[:haproxy][:maxcon_factor_static_ssl]
```