美文网首页
apache虚拟主机配置(2.2和2.4)

apache虚拟主机配置(2.2和2.4)

作者: 妄自 | 来源:发表于2018-05-06 17:43 被阅读0次
2.2和2.4配置虚拟主机多少有点不一样,今天给大家总结写,方便大家配置。

1.编辑httpd (以下为我自己的apache路径)

  • 注释以下代码 (开启虚拟主机时,最好关闭主文件中的虚拟主机,否则输入的域名会被解析到主配置中的虚拟目录中)
    image.png
  • 去掉前面注释 (开启虚拟主机)
    image.png

2.编辑httpd-vhost.conf中配置想新增的站点 (以下为我自己的apache路径)

image.png image.png

代码如下

apache2.4权限配置

<VirtualHost *:80>
    DocumentRoot "F:/phpdemo"
    ServerName www.ct.com
    DirectoryIndex index.php
    <Directory "F:/phpdemo">
     Options Indexes FollowSymlinks
         AllowOverride All
         Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "F:/demo"
    ServerName www.123.com
    DirectoryIndex index.php
    <Directory "F:/demo">
     Options Indexes FollowSymlinks
         AllowOverride All
         Require all granted
    </Directory>
</VirtualHost>

apache2.2权限配置

image.png

3.编辑hosts

image.png
image.png

修改apache配置文件是,记住重启apache!!!!

觉得有用的小伙伴点个关注和小红心就行😄,么么哒。

相关文章

网友评论

      本文标题:apache虚拟主机配置(2.2和2.4)

      本文链接:https://www.haomeiwen.com/subject/jumurftx.html