Xampp使用Apache配置二级域名,apache怎么配置二级域名?

前提是在服务器供应商 ( 我的是阿里云 ) 将一级域名、二级域名都是用A解析解析在服务器上,可以ping通

首先打开 / xampp / apache / conf / httpd.conf

  1. // 将下面这行文本注释去掉 注释是用 # 来注释的
  2. Include conf/extra/httpd-vhosts.conf

然后打开 c / windows / system32 / drivers / etc / hosts 配置 host

  1. 127.0.0.1 xxx.com # 一级域名
  2. 127.0.0.1 a.xxx.com # 二级域名

最后一步就是配置二级域名指向路径

打开 / xampp / apache / conf / extra / httpd-vhosts.conf

  1. # 跟配置一级域名一样
  2. <VirtualHost *:80>
  3. ServerName xueshuai.top # 你的一级域名
  4. DocumentRoot "C:NewFilewebxueshuai.topdist" # 一级域名指向路径
  5. <Directory "C:NewFilewebxueshuai.topdist">
  6. Options FollowSymLinks IncludesNOEXEC Indexes
  7. DirectoryIndex index.html index.htm index.php
  8. AllowOverride all
  9. Order Deny,Allow
  10. Allow from all
  11. Require all granted
  12. </Directory>
  13. </VirtualHost>
  14. <VirtualHost *:80>
  15. ServerName a.xueshuai.top # 你的二级域名
  16. DocumentRoot "C:NewFileweba.xueshuai.topdist" # 二级域名指向路径
  17. <Directory "C:NewFileweba.xueshuai.topdist">
  18. Options FollowSymLinks IncludesNOEXEC Indexes
  19. DirectoryIndex index.html index.htm index.php
  20. AllowOverride all
  21. Order Deny,Allow
  22. Allow from all
  23. Require all granted
  24. </Directory>
  25. </VirtualHost>
原文地址:https://www.cnblogs.com/xue-shuai/p/13536701.html