[問題] 一個IP或一台電腦架不同網站?
問題是這樣的:
我想用一個IP或一個電腦架兩個網站 網站名稱分別是host1跟host2
一般apache是把/var/www/html/index.html 當作首頁
假設我的IP是 123.123.123.123
當瀏覽器連接到 http://123.123.123.123/ 就等同連線到 index.html
看httpd.conf檔的感覺 好像只能設定一個首頁index.html
而且 http://host1 http://host2
都只能對應到 http://123.123.123.123:80/index.thml
目前想到一個IP 開不同網站的方法就是開不同的port
假設我開81跟82好了 再去申請兩個host name:host1跟host2
讓 http://host1對應到 http://123.123.123.123:81/index1.html
讓 http://host2對應到 http://123.123.123.123:82/index2.html
可以這樣嗎?要怎麼弄?
滿困惑的 ....謝謝大家
--
※ 發信站: 批踢踢實業坊(ptt.cc)
※ 編輯: ringballer 來自: 118.168.120.121 (04/13 13:42)
推
04/13 13:47, , 1F
04/13 13:47, 1F
→
04/13 13:50, , 2F
04/13 13:50, 2F
推
04/13 14:52, , 3F
04/13 14:52, 3F
→
04/13 15:03, , 4F
04/13 15:03, 4F
→
04/13 15:04, , 5F
04/13 15:04, 5F
→
04/13 15:05, , 6F
04/13 15:05, 6F
→
04/13 15:08, , 7F
04/13 15:08, 7F
※ 編輯: ringballer 來自: 118.168.70.109 (04/13 15:10)
推
04/13 15:17, , 8F
04/13 15:17, 8F
→
04/13 16:41, , 9F
04/13 16:41, 9F
→
04/13 16:42, , 10F
04/13 16:42, 10F
→
04/13 17:07, , 11F
04/13 17:07, 11F
我在httpd.conf加的東西
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName host1.com
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www1/html
ServerName host2.net
<Directory "/var/www1/html">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
※ 編輯: ringballer 來自: 118.168.82.15 (04/13 20:55)
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):