1.apache主配置文件引入文件
#Include conf/extra/http-vhosts.conf
取消注释或在其下另Include conf/vhosts.conf 文件并创建
配置内容大致为:
<VirtualHost _default_:80>
DocumentRoot "/usr/local/apache2/htdocs" <Directory "/usr/local/apahce2/htdocs"> Options -Indexes +FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost><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><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权限。