一、E:\xampp\apache\conf下 httpd.conf 的配置如下
1、將 Include conf/extra/httpd-vhosts.conf 前邊的註釋去掉
2、設置根目錄 DocumentRoot "E:/workspace"
<Directory "E:/workspace">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
二、E:\xampp\apache\conf\extra下 httpd-vhosts.conf 的配置如下
<VirtualHost *:80>
ServerAdmin www.statistics.com
DocumentRoot "E:/workspace/Sma_Statistics/MarketingManage"
ServerName statistics.com
ServerAlias www.statistics.com
ErrorLog "logs/web.log"
CustomLog "logs/web.log" common
</VirtualHost>
如果項目路徑不是根目錄,則需加上以下紅色部分配置
<VirtualHost *:80>
ServerAdmin www.tp.com
DocumentRoot "E:/workspace1/TPStudy"
<Directory />
AllowOverride All
Order deny,allow
Allow from all
Require all granted
</Directory>
ServerName tp.com
ServerAlias www.tp.com
ErrorLog "logs/web.log"
CustomLog "logs/web.log" common
</VirtualHost>
三、C:\Windows\System32\drivers\etc下 hosts 的配置如下
127.0.0.1 www.tp.com