亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 網站 > Nginx > 正文

詳解nginx 代理多個服務器(多個server方式)

2024-08-30 12:29:14
字體:
來源:轉載
供稿:網友

上一篇文章介紹了nginx的基本配置和使用方法,并且簡單的介紹了一下如何利用nginx結合tomcat進行使用,達到反向代理的作用。現在我們要使用nginx達到這樣的一個目的,能夠代理多個服務器。

首先修改配置文件:

#user nobody; 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 {  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 on;   server {   listen  9922;   server_name firstProxyServer;    #charset koi8-r;    #access_log logs/host.access.log main;    #location / {    #root html;    #index index.html index.htm;   #}   location / {    proxy_pass http://localhost:8989;   }    #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;   #}  }    server {   listen  9977;   server_name secondProxyServer;    #charset koi8-r;    #access_log logs/host.access.log main;    #location / {    #root html;    #index index.html index.htm;   #}   location / {    proxy_pass http://localhost:8080;   }    #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 / {  #  root html;  #  index index.html index.htm;  # }  #}    # HTTPS server  #  #server {  # listen  443 ssl;  # server_name localhost;   # ssl_certificate  cert.pem;  # ssl_certificate_key cert.key;   # ssl_session_cache shared:SSL:1m;  # ssl_session_timeout 5m;   # ssl_ciphers HIGH:!aNULL:!MD5;  # ssl_prefer_server_ciphers on;   # location / {  #  root html;  #  index index.html index.htm;  # }  #}  } 

其中主要的是有兩個server,每個server對應的被代理的服務器的不同。從而實現了nginx代理多個服務器的目的。

下面是兩個服務server的配置:

server {   listen  9922;   server_name firstProxyServer;    #charset koi8-r;    #access_log logs/host.access.log main;    #location / {    #root html;    #index index.html index.htm;   #}   location / {    proxy_pass http://localhost:8989;   }    #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;   #}  }    server {   listen  9977;   server_name secondProxyServer;    #charset koi8-r;    #access_log logs/host.access.log main;    #location / {    #root html;    #index index.html index.htm;   #}   location / {    proxy_pass http://localhost:8080;   }    #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;   #}  } 

下面是測試的結果:

首先兩個tomcat中部署兩個服務器:

nginx,代理多個服務器,代理服務器

nginx,代理多個服務器,代理服務器

然后啟動nginx。

cmd下:start nginx

分別訪問這兩個server:

http://localhost:9922/ngtt/

nginx,代理多個服務器,代理服務器

http://localhost:9977/testnnnn/

nginx,代理多個服務器,代理服務器

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
亚洲美女视频网| 久久精品人人爽| 国产精品欧美在线| 中文字幕亚洲一区二区三区五十路| 亚洲男人的天堂在线播放| 久久视频免费在线播放| 国产婷婷成人久久av免费高清| 日韩精品极品视频免费观看| www.日韩av.com| 国产午夜精品久久久| 久99久在线视频| 91精品视频专区| 亚洲精品国产精品乱码不99按摩| 91久久精品在线| 国产精品久久久久久av| 成人免费在线视频网站| 国产午夜精品视频| 成人动漫网站在线观看| 九九久久国产精品| 韩日精品中文字幕| 91精品久久久久久久久青青| 欧美一级淫片aaaaaaa视频| 国产精品美女久久久免费| 国产精品视频在线播放| 日韩电影免费观看在线观看| 精品日韩中文字幕| 精品在线观看国产| 久久精彩免费视频| 97精品一区二区三区| 亚洲第一福利网站| 最好看的2019年中文视频| 日本久久精品视频| 亚洲在线免费观看| 欧美精品久久久久久久免费观看| 亚洲精品v天堂中文字幕| 欧美精品一区在线播放| 38少妇精品导航| 欧美多人乱p欧美4p久久| 91精品国产高清自在线看超| 欧美国产日韩xxxxx| 国产精品久久一区主播| 亚洲最新av在线| 欧美精品制服第一页| 欧美在线免费观看| 欧美一级在线亚洲天堂| 亚洲国产精品人久久电影| 国产91成人在在线播放| 欧美中文字幕在线播放| 国产精品美女久久久免费| 久久综合免费视频影院| 欧美成人免费网| 国产精品对白刺激| 美女福利精品视频| 亚洲人成自拍网站| 2024亚洲男人天堂| 国产在线观看精品一区二区三区| 亚洲成人av片在线观看| 国产欧美一区二区三区久久人妖| 欧美性xxxxhd| 亚洲欧美综合精品久久成人| 亚洲国产99精品国自产| 成人xxxx视频| 亚洲精品综合精品自拍| 国产精品美女久久| 91产国在线观看动作片喷水| 亚洲国产精品成人va在线观看| 美女少妇精品视频| 久久激情视频免费观看| 38少妇精品导航| 欧美日韩一二三四五区| 欧美日韩国产一区二区三区| 欧美日韩免费在线观看| 亚洲自拍偷拍第一页| 91亚洲午夜在线| 国产精品免费电影| 免费av一区二区| 宅男66日本亚洲欧美视频| 国产精品老牛影院在线观看| 国产香蕉97碰碰久久人人| 国产偷亚洲偷欧美偷精品| 亚洲欧美日韩国产成人| 欧美日韩国产综合视频在线观看中文| 成人性生交大片免费看视频直播| 午夜精品久久久久久99热| 91在线中文字幕| 国产在线视频91| 国产精品一区二区久久久久| 日本免费一区二区三区视频观看| 成人免费在线视频网址| 日本午夜在线亚洲.国产| 亚洲free性xxxx护士hd| 亚洲欧洲视频在线| 久久不射电影网| 欧洲精品久久久| 成人亚洲综合色就1024| 91chinesevideo永久地址| 亚洲午夜av电影| 在线播放日韩欧美| 第一福利永久视频精品| 欧美高清视频在线播放| 精品福利免费观看| 亚洲欧美一区二区三区久久| 亚洲成avwww人| 国产精品一区=区| 日韩黄色高清视频| 欧美一区在线直播| 91深夜福利视频| 亚洲综合精品伊人久久| 亚洲日本成人女熟在线观看| 国产精品视频一区国模私拍| 国产精品久久av| 亚洲自拍欧美色图| 亚洲丝袜av一区| 亚洲福利视频网站| 欧美性极品xxxx做受| 精品福利在线观看| 91亚洲精品在线观看| 岛国视频午夜一区免费在线观看| 亚洲国产成人精品女人久久久| 亚洲男人天堂手机在线| 日韩福利伦理影院免费| 久久亚洲精品视频| 亚洲国产高潮在线观看| 亚洲人a成www在线影院| 北条麻妃一区二区三区中文字幕| 一区二区欧美日韩视频| 日本一区二区三区在线播放| 久久理论片午夜琪琪电影网| 日韩av黄色在线观看| 亚洲一区二区三区四区在线播放| 成人网欧美在线视频| 中文字幕少妇一区二区三区| 日韩av在线网页| 成人在线观看视频网站| 国产欧美精品一区二区三区介绍| 青草热久免费精品视频| 亚洲欧美日韩国产中文专区| 一区二区三区视频观看| 欧美精品久久久久久久久久| 亚洲аv电影天堂网| 日韩一区二区精品视频| 中文字幕9999| 九九精品在线观看| 欧美国产高跟鞋裸体秀xxxhd| 91精品国产91久久久久久| 成人福利网站在线观看| 夜夜嗨av一区二区三区免费区| 欧美激情精品在线| 97国产精品人人爽人人做| 欧美激情乱人伦一区| 欧美成人中文字幕| 欧美亚洲视频在线观看| 精品久久久久久中文字幕大豆网| 国产精品亚洲аv天堂网| 91经典在线视频| 欧美中文在线免费| 欧美超级免费视 在线| 日韩精品视频免费在线观看| 秋霞成人午夜鲁丝一区二区三区| 在线播放日韩专区| 在线播放亚洲激情| 国产亚洲美女精品久久久| 亚洲小视频在线观看| 欧美成人一区二区三区电影|