zoukankan      html  css  js  c++  java
  • 在阿帕奇上配置虚拟主机

    Apache配置须知:

             Listen 80:端口监听,这个地方可以设置监听多个端口,设置方式

                       Listen 80

                       Listen 8080

             DocumentRoot ‘路径’:网站根目录

             ServerName ‘域名:80’:域名

             <Directory ‘路径’>

                       DirectoryIndex index.html index.php

                       Options Indexes

                       Order Deny,Allow

                       Allow from all

             </Directory>

    在"httpd.conf"文件的最下端添加一下代码:

    ############################################
    #这里以下是我们的虚拟主机(多域名)配置
    ############################################
    
    #配置虚拟主机必须使用NameVirtualHost属性,意思表示所有通过80端口的请求,都会先从虚拟主机进行解析
    NameVirtualHost *:80
    
    #VirtualHost可以理解为就是一个虚拟主机
    <VirtualHost *:80>
    
        #域名,每个虚拟主机都有一个域名对应,域名随便取
        ServerName www.php.com
    
        #指定网站的根目录
        DocumentRoot "F:/homework"
    
        #给根目录指定用户访问的权限
        <Directory "F:/homework">
    
        #如果没有首页的情况下,显示文件列表
            Options Indexes
            #DirectoryIndex index11.php che.html
        #权限
        Order Deny,Allow
        Allow from all
        </Directory>
    
        #增加一个虚拟目录
        alias /project "F:/homework/20140320"
        
        #为虚拟目录所对应的实际目录分配访问权限
        <Directory "F:/homework/20140320">
        #Options Indexes
        Order Deny,Allow
        Allow from all
        </Directory>
    </VirtualHost>
    
    #<VirtualHost *:80>
    #    ServerName localhost
    #    DocumentRoot "E:/Program Files/wamp/www/"
    #    <Directory "E:/Program Files/wamp/www/">
    #        Options Indexes
    #    DirectoryIndex index.php index.html index.php3 index.htm
    #    Order Deny,Allow
    #    Allow from all
    #    </Directory>
    #</VirtualHost>
  • 相关阅读:
    Nagios利用NSClient++监控Windows主机
    Nagios监控Windows的网卡流量
    Nagios 监控Windows服务器(详细篇)
    ODB学习笔记之基础环境搭建
    用Kindle阅读PDF最简单的3个方法!
    RocketMQ吐血总结
    RocketMQ使用
    掌握 analyze API,一举搞定 Elasticsearch 分词难题
    ElasticSearch5.3安装IK分词器并验证
    Kibana server is not ready yet出现的原因
  • 原文地址:https://www.cnblogs.com/xbblogs/p/5176619.html
Copyright © 2011-2022 走看看