本文最后更新于 3759 天前,其中的信息可能已经有所发展或是发生改变。
对于不喜欢折腾运行环境的同学来说,集成环境包绝对是好东西。由于WAMP上php5.6版本有点小坑,现在已转向XAMPP的怀抱。
给apache服务器授权
打开Apache的配置文件httpd.conf,找到下面的节点
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
#
# 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>
可以看到已经在C:/xampp/htdocs目录下授权了,你可以把多个项目放在该目录下。我一般习惯在非系统盘放置项目,此时将C:/xampp/htdocs改为自定义目录就可以。
接着查看是否加载了vhost的配置文件。若你的配置文件没有这一行,你可以手动添加上去并在对应目录新建httpd-vhosts.conf配置文件。
# Virtual hosts Include conf/extra/httpd-vhosts.conf
添加虚拟站点
打开httpd-vhosts.conf文件,为每个项目添加如下节点即可
<VirtualHost *:80>
DocumentRoot "G:\WWWROOT\entersgu"
ServerName 127.0.0.2
</VirtualHost>