zoukankan      html  css  js  c++  java
  • windows下apache配置站点

    通过hosts域名映射

    127.0.0.1   www.moban.com
    NameVirtualHost *:80
    #配置 www.moban.com 虚拟主机
    <VirtualHost *:80>
            #绑定域名
            ServerName www.moban.com
            #网站根目录
            DocumentRoot "D:WWWmoban"
            #网站默认首页文件
            DirectoryIndex index.html index.php
            #网站目录访问权限
            <Directory "D:WWWmoban">
                    Options Indexes  FollowSymLinks
                    #允许网站空间目录的分布式配置文件.htaccess
                    #对虚拟主机的权限进行覆盖
                    AllowOverride All
                    Order Deny,Allow
                    Allow from All
            </Directory>
    </VirtualHost>
    NameVirtualHost *:80
    <VirtualHost *:80>
        ServerName  www.test.com.cn
        DocumentRoot "D:xampphtdocswwwapiPublic"
        DirectoryIndex index.html index.php
    </VirtualHost>
    
    
    NameVirtualHost *:80
    <VirtualHost *:80>
        ServerName  www.666.com
        DocumentRoot "D:xampphtdocs666"
        DirectoryIndex index.html index.php
    </VirtualHost>
    
    NameVirtualHost *:80
    <VirtualHost *:80>
        ServerName  www.888.com
        DocumentRoot "D:xampphtdocs888"
        DirectoryIndex index.html index.php
    </VirtualHost>

    通过ip

    //可能会导致apache启动过慢
    <VirtualHost 127.0.0.2:80> DocumentRoot "D:WWW est_ip" DirectoryIndex index.html index.php <Directory "D:WWW est_ip"> Options Indexes FollowSymLinks AllowOverride All Order Deny,Allow Allow from All #Require all granted </Directory> </VirtualHost>

    通过相同ip不同端口配置

    <VirtualHost 192.168.1.102:80>
    DocumentRoot "D:WWW	est_ip"
      DirectoryIndex index.html index.php
      <Directory "D:WWW	est_ip">
        Options Indexes  FollowSymLinks
           AllowOverride All
            Order Deny,Allow
           Allow from All
       #Require all granted
      </Directory>
    </VirtualHost>
    
    <VirtualHost 192.168.1.102:8080>
    DocumentRoot "D:WWWmoban"
      DirectoryIndex index.html index.php
      <Directory "D:WWWmoban">
        Options Indexes  FollowSymLinks
           AllowOverride All
            Order Deny,Allow
           Allow from All
       #Require all granted
      </Directory>
    </VirtualHost>

    默认是没有开启其他端口的

    如果出现拒绝访问则需要改httpd.conf文件

    DocumentRoot  "D:phpStudyWWW"
    <Directory />
        Options +Indexes +FollowSymLinks +ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
       Require all granted
    </Directory>

     也有可能是vhost.conf中

      Options FollowSymLinks ExecCGI    //
      Options +Indexes +FollowSymLinks +ExecCGI    //改为

     phpstudy 中

    Options -Indexes -FollowSymLinks +ExecCGI  //将
    Options +Indexes +FollowSymLinks +ExecCGI  //改为
    #apache加载php模块
    LoadModule php5_module "C:wampphpphp5apache2_2.dll"
    AddType application/x-httpd-php .php
    PHPIniDir "C:wampphp"
  • 相关阅读:
    浏览器返回按钮不会触发onLoad事件
    js常用方法
    清除浮动
    Hbuilder快捷键
    页面跳转
    castapp.js颜色配置
    mui学习
    css 特殊使用技巧
    mui框架如何实现页面间传值
    从0到千万级访问量网站架构演变史
  • 原文地址:https://www.cnblogs.com/mengor/p/7841529.html
Copyright © 2011-2022 走看看