標籤:color 配置 src Owner ecc inf pen clu dns
1. 將 http://www.a.com 與 http://www.b.com 的DNS解析到你的伺服器IP上。
2. 刪除apache的預設主控件設定檔。你也不希望建立2個虛擬機器主機後人家還能直接存取/var/www/ 吧 ;
進入 /etc/apache2/sites-enabled/ ; 刪除 000-default 檔案。
3. 在 /etc/apache2/sites-enabled/ 目錄 , 用VI建立2個檔案。檔案名稱用 www.a.com.conf ; www.b.com.conf
在 www.a.com.conf 裡填入以下代碼:
1 <VirtualHost *:80> 2 ServerName www.a.com 3 ServerAdmin [email protected] 4 DocumentRoot /var/www/www.a.com 5 <Directory /> 6 Options FollowSymLinks 7 AllowOverride None 8 </Directory> 9 <Directory /var/www/www.a.com/>10 Options Indexes FollowSymLinks MultiViews11 AllowOverride None12 Order allow,deny13 allow from all14 </Directory>15 16 ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/17 <Directory "/usr/lib/cgi-bin">18 AllowOverride None19 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch20 Order allow,deny21 Allow from all22 </Directory>23 24 #ErrorLog ${APACHE_LOG_DIR}/error.log25 26 # Possible values include: debug, info, notice, warn, error, crit,27 # alert, emerg.28 LogLevel warn29 30 #CustomLog ${APACHE_LOG_DIR}/access.log combined31 32 Alias /doc/ "/usr/share/doc/"33 <Directory "/usr/share/doc/">34 Options Indexes MultiViews FollowSymLinks35 AllowOverride None36 Order deny,allow37 Deny from all38 Allow from 127.0.0.0/255.0.0.0 ::1/12839 </Directory>40 41 </VirtualHost>www.a.com.conf
1 <VirtualHost *:80> 2 ServerName www.b.com 3 ServerAdmin [email protected] 4 DocumentRoot /var/www/www.b.com 5 <Directory /> 6 Options FollowSymLinks 7 AllowOverride None 8 </Directory> 9 <Directory /var/www/www.b.com/>10 Options Indexes FollowSymLinks MultiViews11 AllowOverride None12 Order allow,deny13 allow from all14 </Directory>15 16 ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/17 <Directory "/usr/lib/cgi-bin">18 AllowOverride None19 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch20 Order allow,deny21 Allow from all22 </Directory>23 24 #ErrorLog ${APACHE_LOG_DIR}/error.log25 26 # Possible values include: debug, info, notice, warn, error, crit,27 # alert, emerg.28 LogLevel warn29 30 #CustomLog ${APACHE_LOG_DIR}/access.log combined31 32 Alias /doc/ "/usr/share/doc/"33 <Directory "/usr/share/doc/">34 Options Indexes MultiViews FollowSymLinks35 AllowOverride None36 Order deny,allow37 Deny from all38 Allow from 127.0.0.0/255.0.0.0 ::1/12839 </Directory>40 41 </VirtualHost>www.b.com.conf
apache詳細許可權在以上設定檔修改就行。
文章轉自:http://forum.ubuntu.org.cn/viewtopic.php?t=341070
【轉】Ubuntu+apache綁定多個網域名稱