最新消息:XAMPP默认安装之后是很不安全的,我们只需要点击左方菜单的 "安全"选项,按照向导操作即可完成安全设置。

XAMPP配置二级域名通过不同端口访问不同网站

XAMPP教程 admin 1017浏览 0评论

首先需要在xampp\apache\conf\extra\httpd-vhost.conf中写入配置的二级域名

  1. <VirtualHost *:8081> // 该网站通过监测8081端口
  2. ServerName blogs.xueshuai.com // 自定义二级域名
  3. DocumentRoot “C:\NewFile\web\Blogs” // 二级域名所指向的路径
  4. <Directory “C:\NewFile\web\Blogs”>
  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 *:8082> // 该网站通过监测8082端口
  14. ServerName news.xueshuai.com // 自定义二级域名
  15. DocumentRoot “C:\NewFile\web\MyWeb-Nuxt.js\dist” // 二级域名所指向的路径
  16. <Directory “C:\NewFile\web\MyWeb-Nuxt.js\dist”>
  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>

其次,修改C:\Windows\System32\drivers\etc\hosts

在最下方添加

  1. 127.0.0.1 blogs.xueshuai.top
  2. 127.0.0.1 news.xueshuai.top

最后,打开下图的位置,在里面监测端口上方的8081和8082

ew000082

  1. Listen 80 // 默认检测
  2. Listen 8081
  3. Listen 8082

转载请注明:XAMPP中文组官网 » XAMPP配置二级域名通过不同端口访问不同网站

您必须 登录 才能发表评论!