国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > Nginx > 正文

Nginx多層代理配置方法

2024-08-30 12:22:48
字體:
供稿:網(wǎng)友
這篇文章主要介紹了Nginx多層代理配置方法,此篇文章只給大家介紹nginx的多級代理配置代碼,需要的朋友可以參考下

此篇只說nginx的多級代理配置,不扯其他的.

需求:hba.changyoufun.com-121.201.125.239(gd1)--hk1--co(alphaclash.ggdev.co)  廣東代理--->香港--->加拿大

由于idc機房在加拿大,所以經(jīng)常會配些nginx多級反向代理到國內(nèi).(不做代理client就得翻墻,或者說是丟包很嚴重.)

下面的Nginx配置我只寫80的,443的忽略,簡化nginx的配置,參數(shù)也不一一列舉不然太多了.

gd1的反向代理配置:(就是一個反向代理)

cat hba.changyoufun.com.confserver{ listen 121.201.125.239:80;  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配置(代理的是hk1的內(nèi)網(wǎng)ip): upstream hba80 {  server 10.105.3.222:80;    } upstream hba443 {  server 10.105.3.222:443;    }

hk1的反向代理配置:(也是一個nginx反向代理)

cat hba.changyoufun.com.confserver{ listen 10.105.3.222:80; 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配置(代理的是alphaclash.ggdev.co域名的ip地址):

upstream hba80 {  server 216.66.17.34:80;    } upstream hba443 {  server 216.66.17.34:443;    }

co機房原先已經(jīng)存在alphaclash.ggdev.co域名的配置,只需要copy一份alphaclash.ggdev.co的nginx配置,將域名替換為hba.changyoufun.com即可.

co的兩份nginx配置:

nginx和php的web版:

cat hba.changyoufun.com.confserver{  listen 216.66.17.34:80;  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:80;  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; }}
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 健康| 灵璧县| 灵宝市| 桐城市| 梅州市| 大洼县| 苗栗县| 永胜县| 西平县| 广宗县| 江山市| 渝中区| 陵水| 额济纳旗| 湖北省| 安塞县| 克拉玛依市| 江西省| 晋江市| 克什克腾旗| 读书| 镇雄县| 河东区| 明星| 襄樊市| 萨迦县| 潮安县| 板桥市| 青阳县| 任丘市| 安丘市| 同仁县| 正镶白旗| 湘阴县| 崇仁县| 永和县| 汉寿县| 荥阳市| 长垣县| 浦江县| 秀山|