• 在阿帕奇上配置虚拟主机


    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>
  • 相关阅读:
    [9.运算符] 零基础学python,简单粗暴
    [8.转义字符&占位符] 零基础学python,简单粗暴
    [7.程序错误] 零基础学python,简单粗暴
    [6.注释与引号] 零基础学python,简单粗暴
    [5.数据类型] 零基础学python,简单粗暴
    国内的镜像网站大全
    mysql --好用又不贵的函数
    django--dos命令行项目创建未成功错误
    python-----拓展包下载地址
    python----列表转字典
  • 原文地址:https://www.cnblogs.com/xbblogs/p/5176619.html
Copyright © 2020-2023  润新知