1.apache主配置文件引入文件web
#Include conf/extra/http-vhosts.confapache
取消註釋或在其下另Include conf/vhosts.conf 文件並建立ide
配置內容大體爲:ui
<VirtualHost _default_:80>
DocumentRoot "/usr/local/apache2/htdocs"
<Directory "/usr/local/apahce2/htdocs">
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>it
<VirtualHost *:80>
DocumentRoot "/website/www.bxduan.com"
ServerName www.bxduan.com
ServerAlias
<Directory "/website/www.bxduan.com">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>io
<VirtualHost *:80>
DocumentRoot "/website/sc.bxduan.com"
ServerName sc.bxduan.com
ServerAlias
<Directory "/website/sc.bxduan.com">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted ####apache2.4後該命令可取代 Order allow,deny (回車) Allow from all
</Directory>
</VirtualHost>配置
關於相關配置問題,可查看配置文件中的conf/extra/http-vhosts.conf文件中的註釋中的連接,如http://httpd.apache.org/docs/2.4/。配置好保存後可經過apache bin目錄下的httpd命令-S選項查看配置。權限
2.權限問題,需給各站點根目錄,755權限。配置文件