zoukankan      html  css  js  c++  java
  • Windows环境的apache下Virtual Host 设置

      1、找到C:WindowsSystem32driversetc下的hosts文件,在文件最后增加以下内容:

    127.0.0.1 mysite.net

      需要注意的是,此hosts文件可能会不让保存,解决的方法是将此hosts文件拷贝至其它位置(比如桌面),修改完毕后拷贝回来,将原文件覆盖即可。

      2、打开Apache的配置文件httpd.conf,找到Include conf/extra/httpd-vhosts.conf这行,如果这一句前面有#的话,将其去掉。

      3、打开Apache中confextra下的httpd-vhosts.conf文件,在最后写入:

      (1)PHP2.2下

    NameVirtualHost *:80
    <VirtualHost *:80>
    ServerName mysite.net
    DocumentRoot "D:xampphtdocsmysite"
    <Directory "D:xampphtdocsmysite">
    Options FollowSymLinks IncludesNOEXEC Indexes
    DirectoryIndex index.html index.htm index.shtml default.html default.htm index.php default.php    
    AllowOverride All    
    Order Deny,Allow
    Deny from All
    Allow from 127.0.0.1    
    </Directory> 
    </VirtualHost>


      (2)PHP2.4下

    <VirtualHost 127.0.0.1:80>
    ServerName mysite.net
    DocumentRoot "D:xampphtdocsmysite"
    <Directory "D:xampphtdocsmysite">
    Options FollowSymLinks IncludesNOEXEC Indexes
    DirectoryIndex index.html index.htm index.shtml default.html default.htm index.php default.php
    AllowOverride All
    Require all denied
    Require ip 127.0.0.1 ::1
    Require local
    </Directory>
    </VirtualHost>
     
      4、重启Apache,浏览器中输入mysite.net就可以访问D:xampphtdocsmysite这个项目了。

      注意:将上文中红色颜色部分的内容更换为你想要使用的虚拟域名,蓝色部分更换为对应项目存储的路径。 
  • 相关阅读:
    PAT甲级——A1148 WerewolfSimpleVersion【20】
    kruskal算法【最小生成树2】
    prim算法【最小生成树1】
    最小生成树
    关键路径详解
    「日常训练&知识学习」树的直径(POJ-1849,Two)
    「日常训练」Balancing Act(POJ-1655)
    「日常训练」Duff in the Army (Codeforces Round #326 Div.2 E)
    「题目代码」P1054~P1059(Java)
    「日常训练」All Friends(POJ-2989)
  • 原文地址:https://www.cnblogs.com/pallee/p/4078349.html
Copyright © 2011-2022 走看看