TShopping

標題: DNS與Apache虛擬主機設定 [打印本頁]

作者: woff    時間: 2010-4-13 13:35
標題: DNS與Apache虛擬主機設定
DNS上先設定
  1. $ORIGIN .
  2. $TTL 43200      ; 12 hours
  3. xxx.com.tw        IN SOA  dns.xxx.com.tw. root.xxx.com.tw. (
  4.                                 2009110301 ; serial
  5.                                 36000      ; refresh (10 hours)
  6.                                 7200       ; retry (2 hours)
  7.                                 2419200    ; expire (4 weeks)
  8.                                 86400      ; minimum (1 day)
  9.                                 )
  10.                         NS      dns.xxx.com.tw.
  11.                         NS      dns1.xxx.com.tw.
  12.                         MX      10 mail.xxx.com.tw.
  13.                         MX      20 mail1.xxx.com.tw.
  14. $ORIGIN xxx.com.tw.
  15. dns                     A       1.1.1.1
  16. dns1                    A       1.1.1.2
  17. blog                    CNAME   dns1
  18. cgvnet                  CNAME   dns
複製代碼


再來設定虛擬主機
最好不要動httpd.conf裡面設定
在conf.d/目錄下加 xxx.conf就OK
要幾個網域都行
在xxx.conf最上面寫
  1. NameVirtualHost *:80
  2. <VirtualHost *:80>
  3.         DocumentRoot "/var/www/html"
  4.         ServerName dns1.xxx.com.tw:80
  5.         ServerAdmin woff@xxx.com.tw
  6. </VirtualHost>
複製代碼

再來就是虛擬主機要對應的路徑了
  1. <VirtualHost *:80>
  2.         DocumentRoot /home/blog/web/
  3.         ServerName blog.xxx.com.tw
  4.         <Directory "/home/blog/web">
  5.         Options FollowSymLinks
  6.         AllowOverRide   None
  7.         Order Allow,Deny
  8.         Allow from all
  9.         </Directory>
  10. </VirtualHost>
  11. <VirtualHost *:80>
  12.         DocumentRoot /home/home/web/
  13.         ServerName home.xxx.com.tw
  14.         <Directory "/home/home/web">
  15.         Options FollowSymLinks
  16.         AllowOverRide   None
  17.         Order Allow,Deny
  18.         Allow from all
  19.         </Directory>
  20. </VirtualHost>
複製代碼


這樣就完工了啦
去測試一下吧
作者: Yikbd1458    時間: 2013-11-10 00:57
謝謝版主啊!




歡迎光臨 TShopping (http://www.tshopping.com.tw/) Powered by Discuz! X3.2