In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to configure the Nginx multi-tier agent. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
This article only talks about the multi-level proxy configuration of nginx, nothing else.
Demand: hba.changyoufun.com-121.201.125.239 (gd1)-hk1--co (alphaclash.ggdev.co) Guangdong agent-> Hong Kong-> Canada
As the idc computer room is in Canada, it is often equipped with some nginx multi-level reverse agents to China. If you don't act as an agent, client will have to climb over the wall, or the packet loss is very serious.
The following Nginx configuration I only write 80, 443 ignore, simplify the configuration of nginx, parameters are not enumerated otherwise too many.
Reverse proxy configuration of gd1: (that is, a reverse proxy)
Cat hba.changyoufun.com.confserver {listen 121.201.125.239 server_name hba.changyoufun.com; access_log; server_name hba.changyoufun.com; access_log / data/weblogs/hba.changyoufun.com.access.log main; index index.html index.php index.htm; location / {proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host Proxy_redirect off; proxy_read_timeout 600; proxy_connect_timeout 600; proxy_pass http://hba80;}} Upstream configuration (the proxy is hk1's private network ip): upstream hba80 {server 10.105.3.222 Upstream 80;} upstream hba443 {server 10.105.3.222 proxy_connect_timeout 443;}
Reverse proxy configuration for hk1: (also a nginx reverse proxy)
Cat hba.changyoufun.com.confserver {listen 10.105.3.222 server_name hba.changyoufun.com; access_log; server_name hba.changyoufun.com; access_log / data/weblogs/hba.changyoufun.com.access.log main; index index.html index.php index.htm; location / {proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host Proxy_redirect off; proxy_read_timeout 600; proxy_connect_timeout 600; proxy_pass http://hba80;}}
Upstream configuration (proxy is the ip address of the alphaclash.ggdev.co domain name):
Upstream hba80 {server 216.66.17.3480;} upstream hba443 {server 216.66.17.34virtual 443;}
The alphaclash.ggdev.co domain name configuration already exists in the co computer room. You only need to copy a copy of alphaclash.ggdev.co 's nginx configuration and replace the domain name with hba.changyoufun.com.
Two nginx configurations for co:
Web version of nginx and php:
Cat hba.changyoufun.com.confserver {listen 216.66.17.3480; server_name hba.changyoufun.com; access_log / data/weblogs/hba.changyoufun.com.access.log main; index index.html index.php index.htm;root / product/clash/alpha/web/htdocs;location ~ ^ /. * (do | php) ${fastcgi_pass php_proxy; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; include / etc/nginx/fastcgi_params }} cat alphaclash.ggdev.co.confserver {listen 216.66.17.34 data/weblogs/alphaclash.ggdev.co.access.log main; index index.html index.php index.htm;root; server_name alphaclash.ggdev.co; access_log / data/weblogs/alphaclash.ggdev.co.access.log main; index index.html index.php index.htm;root / product/clash/alpha/web/htdocs;location ~ ^ /. * (do | php) ${fastcgi_pass php_proxy; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name Include / etc/nginx/fastcgi_params;}}
Note: in fact, the nginx agent is very simple, many times do not understand, since the agent alphaclash.ggdev.co, the first two levels of agents configured with this domain name is not ok? Think carefully to find the nginx agent to find the domain name according to the ip: port, then find the upstream segment in the location segment to which the location matches, and then find the subordinate domain name according to the ip+port of the upstream segment. Finally, it is found that there is no matching domain name at the last level, so the last layer should be equipped with a matching domain name configuration.
This is the end of the article on "how to configure Nginx multi-tier agents". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.