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"
  • 相关阅读:
    debian 9安装细节
    gnome环境设置
    Linux之crontab定时任务
    独显切换进入图形界面思路
    pycharm多行注释
    如何在cmd中运行.py文件
    如何在 PyCharm 中设置 Python 代码模板
    在R中使用Keras和TensorFlow构建深度学习模型
    kubernetes cert-manager installation
    Simple way to create a tunnel from one local port to another?
  • 原文地址:https://www.cnblogs.com/mengor/p/7841529.html
Copyright © 2011-2022 走看看