• 4

請問單IP 2台web server該怎麼設定?

我來幫Y大講解一下好了
987大大誤認為是多個dns指向同一部web server,實際上Y大要表達的是各種ddns或是domin指向同一個IP但都是不同網站不同主機,這才是這篇文章的主題。
多網址指向同一IP,對應到區網內不同web server業界常常幹的事情。一個web server開給好幾個使用者或者好幾個網站,對應的都是同一IP,domin對應過去都是不同網站,虛擬主機都這樣幹。
Multiple Web Servers的功能就是把多網域指向同一IP不同server的功能

在ros裡設定也不難,但就是設定的時候要了解這個設定是幹啥用的。

要設定的東西有
1.web proxy
2.dns static
3.filewall nat

開啟你的web proxy
然後設定dns static 的domin到對應的IP
再來將filewall從80進來的轉到web proxy
就這樣....

走法會是這樣

AAA.com:80>>>>>>>>>>>>>>lan a server:80
BBB.com:80>web proxy:8080>lan b server:80
CCC.com:80>>>>>>>>>>>>>>lan c server:80

直接貼解法給你看

/ip web-proxy
set enabled=yes src-address=0.0.0.0 port=8080 hostname="你自己取" \
transparent-proxy=yes parent-proxy=0.0.0.0:0 \
cache-administrator="webmaster" max-object-size=4096KiB cache-drive=system \
max-cache-size=unlimited max-ram-cache-size=unlimited
/ip web-proxy access
add dst-port=23-25 action=deny comment="block telnet & spam e-mail relaying" \
disabled=no
add dst-port=80 action=allow comment="Enable Http Connection" disabled=no
/ip dns static add name=AAA.com address=192.168.88.2<區網IP>
/ip dns static add name=BBB.com address=192.168.88.3<區網IP>
/ip dns static add name=CCC.com address=192.168.88.4<區網IP>
/ip firewall nat
add chain=dstnat in-interface=outside dst-address=你的固定IP protocol=tcp \
dst-port=80 action=redirect to-ports=8080 comment="" disabled=no
素聞RouterOS強大
請教...除了網路負載平衡...有沒有伺服器負載平衡呢??
伺服器附載均衡?雙web然後境像嗎?
好奇問一下,為什麼不把php網站也架在IIS上,這樣就可以同時跑php跟asp.net(或asp)?
tppr3695a wrote:
伺服器附載均衡?雙w...(恕刪)

是的...不過鏡像這個詞應該不太對...兩台或以上的WEB程式應該是要一樣
但要手動更新...不會自動更新
我不是很熟這個..以前在縣府寫程式...四台SERVER要一起更新才行
想問說RouterOS是否可行...
SLB的機器好貴...
1. 不管是多個FQDN還是多個DDNS,都可以指向同一個IP。
2. 以HTTP服務而言,在RouterOS內透過WEB Proxy功能,可以將來自不同FQDN卻指向同一個Public IP的連線轉至內網不同Private IP。都是走Port 80。
3. 要作Server Load Balancing可以試著透過RouterOS的PCC(Per-Connection-Classifier),將Source Address作平分
那麼關鍵不再router上,關鍵在你的httpd服務上nginx
tppr3695a wrote:
那麼關鍵不再router上,關鍵在你的httpd服務上nginx

NginX跟Apache都只是HTTPD,負責提供HTTP Service

.Server A, NginX, 192.168.0.10, port 80 (HTTP)
.Server B, Apache, 192.168.0.11, port 80 (HTTP)
.Server C, NginX, 192.168.0.12, port 80 (HTTP)
.Server D, Apache, 192.168.0.13, port 80 (HTTP)

Public IP: 1.32.25.137

FQDN/DDNS:透過RouterOS WEB Proxy可以這樣
.Any Client <-> http://www.ILoveTW.com/ <-> http://1.32.25.137/ <-> http://192.168.0.10/
.Any Client <-> http://www.ILoveCN.com/ <-> http://1.32.25.137/ <-> http://192.168.0.11/
.Any Client <-> http://www.ILoveHK.com/ <-> http://1.32.25.137/ <-> http://192.168.0.12/
.Any Client <-> http://www.ILoveJP.com/ <-> http://1.32.25.137/ <-> http://192.168.0.13/

SLB:透過RouterOS PCC可以這樣
.Client A <-> http://www.ILoveTW.com/ <-> http://1.32.25.137/ <-> http://192.168.0.10/
.Client B <-> http://www.ILoveTW.com/ <-> http://1.32.25.137/ <-> http://192.168.0.11/
.Client C <-> http://www.ILoveTW.com/ <-> http://1.32.25.137/ <-> http://192.168.0.12/
.Client D <-> http://www.ILoveTW.com/ <-> http://1.32.25.137/ <-> http://192.168.0.13/

連線轉發的工作是在Router完成的,關鍵是路由這一段,你可以:
Firewall <-> Router <-> SLB <-> Internal Server

也可以
RouterOS (Firewall <-> Router <-> SLB) <-> Internal Server

Mason.Lyu wrote:
NginX跟Apac...(恕刪)

給你一個讚...感謝!!!
抱歉把這篇文章從深海裡撈上來,
因為我有個設定無法解決,想上來問問各位先進,
Web Proxy的設定我已經搞定,也正常working了,

但是我現在內部有tomcat的服務走8080 port,
我從外部80指向到web proxy後雖然可以指向,但我內部的server只能預設成80 port
假設我要如下

Any Client <-> http://www.ILoveHK.com/ <-> http://1.32.25.137/ <-> http://192.168.0.12:8080/

這樣的話我的RouterOS該怎麼設定?

先感謝各位先進的回答。
專業潛水員
  • 4
內文搜尋
X
評分
評分
複製連結
Mobile01提醒您
您目前瀏覽的是行動版網頁
是否切換到電腦版網頁呢?