当前位置:Gxlcms > PHP教程 > XAMPP配置虚拟主机具体步骤

XAMPP配置虚拟主机具体步骤

时间:2021-07-01 10:21:17 帮助过:43人阅读

1.安装XAMPP安装包到D盘,安装完成后,退出XAMPP集成环境,进入下一步,配置虚拟主机;首先在XAMPP/htdocs目录下新建目录magento2和test文件夹(此文件夹为你的项目全部内容)。

PS.在创建多个虚拟主机时,也需要新建一个文件夹包含你的项目全部内容如magento2和test,如果还需要创建则再创建相应文件夹。

2.找到你的XAMPP安装目录,依次打开以下目录:apache/conf/extra目录找到httpd-vhosts.conf文件,用记事本打开。

3.打开http-vhosts.conf后,在最下面添加如下代码:

  1. <code><virtualhost *:80="">
  2. ServerName www.magento2.com
  3. DocumentRoot "D:/XAMPP/htdocs/magento2"
  4. <directory "d:="" xampp="" htdocs="" magento2"="">
  5. Options FollowSymLinks IncludesNOEXEC Indexes
  6. DirectoryIndex index.html index.htm index.php
  7. AllowOverride all
  8. Order Deny,Allow
  9. Allow from all
  10. Require all granted
  11. </directory>
  12. </virtualhost>
  13. <virtualhost *:80="">
  14. ServerName www.test.com
  15. DocumentRoot "D:/XAMPP/htdocs/test"
  16. <directory "d:="" xampp="" htdocs="" test"="">
  17. Options FollowSymLinks IncludesNOEXEC Indexes
  18. DirectoryIndex index.html index.htm index.php
  19. AllowOverride all
  20. Order Deny,Allow
  21. Allow from all
  22. Require all granted
  23. </directory>
  24. </virtualhost>
  25. </code>

4.此外,需要配置C盘host文件,依次找到下面的目录:C盘/windows/system32/drivers/etc目录,找到hosts文件,用记事本打开,添加127.0.0.1 www.magento2.com 保存,如:

  1. <code>127.0.0.1 www.magento2.com
  2. 127.0.0.1 www.test.com</code>

5.配置虚拟主机完成,重启XAMPP集成环境即可。

以上就介绍了XAMPP配置虚拟主机具体步骤,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

人气教程排行