Nginx Upstream 嘗試請求,重試請求

http { upstream ups { server 192.168.1.1 max_fails=1 fail_timeout=10s; server 192.168.1.2 max_fails=1 fail_timeout=10s; server 192.168.1.3 max_fails=1 fail_timeout=10s; keepalive 1000; } server { listen 80; server_name _; location / { proxy_next_upstream error timeout; proxy_next_upstream_tries 0; proxy_pass http://ups; } } } 配置說明 max_fails=1 fail_timeout=10s 每 10 秒計數到一次失敗,節點判定為壞點 10秒鐘 以此類推 當 max_fails=0 時,停用失敗計數器,即永遠不會判定壞點 proxy_next_upstream error timeout 那些請求狀態會被判定失敗,計算到 max_fails 的計數器 可選的項目有: error timeout invalid_header http_500 http_502 http_503 http_504 http_403 http_404 http_429 non_idempotent off proxy_next_upstream_tries 0 upstream servers 嘗試請求的次數 ...

December 11, 2024

安裝 Nginx 1.9+

新增 nginx.repo vi /etc/yum.repos.d/nginx.repo [nginx] name=nginx repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=0 enabled=1 安裝Nginx yum install nginx 啟動服務 service nginx start chkconfig --levels 235 nginx on

May 5, 2016

CentOS6.5 安裝Nginx

新增 Nginx 官方所提供的第三方套件庫 新增一個檔案 /etc/yum.repos.d/nginx.repo 內容如下 [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1 更新套件庫 yum update -y 安裝 Nginx yum install nginx 執行 Nginx service nginx start 開機時自動啟動 sudo chkconfig --levels 235 nginx on

August 24, 2015

CentOS6.5 安裝LNMP

一、更新rpm MYSQL源 CentOS 6 yum install http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm CentOS 7 yum install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm NGINX源 CentOS 6 yum install http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm CentOS 7 yum install http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm REMI源 最新的PHP版本需要修改REMI.REPO中的ENABLED=0为1)# vi /etc/yum.repos.d/remi.repo CentOS 6 yum install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm CentOS 7 yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm 二、安裝Nginx 安裝 NGINX 網頁伺服器 yum install nginx 三、安裝PHP 想 install 其它版本的 PHP 需要修改 REMI.REPO 中的 ENABLED=0 為 1 路徑:/etc/yum.repos.d/remi.repo [remi-php55]是PHP5.5 [remi-php56]是PHP5.6 選擇你要的版本做修改即可 vi /etc/yum.repos.d/remi.repo 安裝 PHP yum install php 安裝其他PHP Lib yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm ...

August 24, 2015