Re: [問題] 不同網址指向同一IP主機
※ 引述《wolako ( NN )》之銘言:
: 我向學校申請了一臺電腦主機後, 利用Apache2.2架了一個網站
: 名稱取作 abc.def.edu.tw
: 然後我又跟廠商租了一個網址 www.ghi.org.tw
: 打算在同一台主機下,跑不同的網頁內容
: 請問
: 須要怎麼設定才能讓 www.ghi.org.tw也連結到同一臺主機的不同網頁?
: 學校部份的DNS須要申請嗎?
: 1. 設定完成, 網址列輸入 abc.def.edu.tw 或 www.ghi.org.tw
: 可以連結到各自的首頁
: 2. 設定完成後, 使用者能不能在網址列輸入 www.ghi.org.tw/test
: 然後連結到相關測試網站
: 初學者很多都不懂
: 煩請大家指教!!
假設你ip是 xxx.xxx.xxx.xxx
1.abc.def.edu.tw 先假設他的 domain已經設定好了
那這個domain就不需要去動
2.www.ghi.org.tw 要設 A record xxx.xxx.xxx.xxx
通常網域商都會有提供dns代管介面,從那邊去設定就好
3.設定主機上的apache 的 virutal host 檔案
(以ubuntu 而言,通常在 /etc/apache2/sites-enable )
設定方式類似這樣 ,
<VirtualHost *:80>
ServerName abc.def.edu.tw
ServerAdmin webmaster@localhost
DocumentRoot /var/www/xxx 這裡要改成你學校網站資料夾的路徑
</VirtualHost>
<VirtualHost *:80>
ServerName www.ghi.org.tw
ServerAdmin webmaster@localhost
DocumentRoot /var/www/yyy 這裡要改成你ghi網站資料夾的路徑
</VirtualHost>
4.至於能不能打 www.ghi.org.tw/test 就連到測試網站,
這個是另一個議題,原則上至少可以透過proxypass達成。
--
I am a person, and I am always thinking .
Thinking in love , Thinking in life ,
Thinking in why , Thinking in worth.
I can't believe any of what ,
I am just thinking then thinking ,
but worst of all , most of mine is thinking not actioning...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.136.103.160
推
04/13 16:57, , 1F
04/13 16:57, 1F
討論串 (同標題文章)