99偷拍视频精品区一区二,口述久久久久久久久久久久,国产精品夫妇激情啪发布,成人永久免费网站在线观看,国产精品高清免费在线,青青草在线观看视频观看,久久久久久国产一区,天天婷婷久久18禁,日韩动漫av在线播放直播

centos7下如何配置nginx反向代理負載均衡集群-創新互聯

這篇文章將為大家詳細講解有關centos7下如何配置nginx反向代理負載均衡集群,文章內容質量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關知識有一定的了解。

目前創新互聯已為近1000家的企業提供了網站建設、域名、網頁空間、綿陽服務器托管、企業網站設計、德興網站維護等服務,公司將堅持客戶導向、應用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協力一起成長,共同發展。
nginx是一個web服務器,類似apache一樣,但是比apache性能更好,更快。還可以實現反向代理,和負載均衡,常用于構建web服務集群的負載均衡。今天就來記錄一下,nginx的安裝與配置,實現負載均衡的作用。

實驗環境:

192.168.1.188    nginx負載均衡器

192.168.1.189    web01服務器

192.168.1.190    web02服務器

軟件準備:

centos7.4 x86_64

nginx-1.6.3.tar.gz

安裝nginx軟件

安裝依賴軟件包 命令集合

[root@localhost ~]# yum -y install openssl openssl-devel pcre pcre-devel gcc

安裝nginx軟件包 命令集合

[root@localhost ~]# mkdir /app
[root@localhost ~]# cd /app
[root@localhost ~]# wget -q http://nginx.org/download/nginx-1.6.3.tar.gz
[root@localhost ~]# useradd -s /sbin/nologin -M
[root@localhost ~]# tar xf nginx-1.6.3.tar.gz
[root@localhost ~]# cd nginx-1.6.3
[root@localhost ~]# ./configure --user=nginx --group=nginx --prefix=/app/nginx --with-http_stub_status_module --with-http_ssl_module
[root@localhost ~]# make && make install

配置文件

(以下操作在web01和web02上進行)

[root@localhost ~]# vim /app/nginx/conf/nginx.conf

將配置文件修改為以下內容

worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "http_referer" '
'"$http_user_agent" " $http_x_forwarded_for"';
server {
listen 80;
server_name bbs.dengchuanghai.org;
location / {
root html/bbs;
index index.html index.htm;
}
access_log logs/access_bbs.log main;
}
}
[root@localhost ~]# mkdir /app/nginx/html/bbs
[root@localhost ~]# echo "192.168.1.189 bbs" >>/app/nginx/html/bbs/index.html            
[root@localhost ~]# echo "192.168.1.189 bbs.dengchuanghai.org" >> /etc/hosts                     
[root@localhost ~]# echo "192.168.1.190 bbs" >>/app/nginx/html/bbs/index.html  
[root@localhost ~]# echo "192.168.1.190 bbs.dengchuanghai.org" >> /etc/hosts

(分別在兩臺web服務器上輸入以上內容)

然后分別啟動nginx

[root@localhost ~]# /app/nginx/sbin/nginx -t (檢查配置文件有無錯誤)
[root@localhost ~]# /app/nginx/sbin/nginx  啟動
[root@localhost ~]# ss -tnlp | grep 80

使用curl bbs.dengch
centos7下如何配置nginx反向代理負載均衡集群
,以下操作在nginx負載均衡器上進行

[root@localhost ~]# vim /app/nginx/conf/nginx.conf

更改為如下內容

worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream www_server_pools{
server 192.168.1.190:80 weight=1;
server 192.168.1.189:80 weight=1;
}
server {
listen 80;
server_name www.dengchuanghai.org;
location / {
proxy_pass http://www_server_pools;
}
}
}
[root@localhost ~]# echo "192.168.1.188 www.dengchuanghai,org" >> /etc/hosts

檢查語法

[root@localhost ~]# /app/nginx/sbin/nginx -t

啟動服務

[root@localhost ~]# /app/nginx/sbin/nginx

centos7下如何配置nginx反向代理負載均衡集群
使用curl www.dengchuanghai.org
centos7下如何配置nginx反向代理負載均衡集群
發現結果輸出為兩臺服務器輪流輸出

實驗結束

關于centos7下如何配置nginx反向代理負載均衡集群就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

新聞名稱:centos7下如何配置nginx反向代理負載均衡集群-創新互聯
地址分享:http://www.yijiale78.com/article42/ddcoec.html

成都網站建設公司_創新互聯,為您提供企業網站制作、建站公司網站營銷做網站、定制開發、關鍵詞優化

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

微信小程序開發