• apache基于域名的虚拟主机配置


    在apache基于域名的虚拟主机配置中,多种方式可以达到相同的目的,在配置过程中将其中一个个人认为比较简单、明了的配置记录下来,以免忘记。

    1、当在一台linux主机里搭建多个站点的,需要有一个默认的站点,在httpd.conf文件中修改添加:

    <VirtualHost _default_:80>
    DocumentRoot /var/www/html
    < /VirtualHost>
    对此页面可以做些处理,尽量不要开启默认站点。

    2、把#NameVirtualHost *:80前面的#去掉,即可开启虚拟主机的功能

    3、接下来可以正式添加虚拟主机了,配置如下,根据自己的要求来配置:

    <VirtualHost *:80>
    ServerAdmin webmaster@.example.com
    DocumentRoot /var/www/ns/
    ServerName ns.example.com
    ErrorLog logs/ns.example.com-error_log
    CustomLog logs/ns.example.com-access_log common
    < /VirtualHost>
    < VirtualHost *:80>
    ServerAdmin webmaster@abc.com
    DocumentRoot /var/www/phpmyadmin
    ServerName www.abc.com
    ErrorLog logs/www.abc.com-error_log
    CustomLog logs/www.abc.com-access_log common
    < /VirtualHost>

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------

    同时在C:\WINDOWS\system32\drivers\etc\hosts表中设置
    127.0.0.1 localhost
    127.0.0.1 fading.cn
    127.0.0.1 dz6.fading.cn
    127.0.0.1 x.fading.cn
    或者修改DNS,多个域名指向同一个IP地址
    访问路径:
    http://fading.cn或localhost
    http://dz6.fading.cn
    http://x.fading.cn

    别名alias:

    Alias /dz6/ "d:/http/wwwroot/Discuz!_6.0.0_SC_GBK/upload/"
    <Directory "d:/http/wwwroot/Discuz!_6.0.0_SC_GBK/upload">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>

    Alias /x/ "d:/http/wwwroot/xspace/upload/"
    <Directory "d:/http/wwwroot/xspace/upload">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
    访问的时候一定用
    http://localhost/x/ 加上/
    http://localhost/dz6/ 加上/

  • 相关阅读:
    java web项目打包.war格式
    version 1.4.2-04 of the jvm is not suitable for thi
    Sugarcrm Email Integration
    sharepoint 2010 masterpage中必须的Content PlaceHolder
    微信开放平台
    Plan for caching and performance in SharePoint Server 2013
    使用自定义任务审批字段创建 SharePoint 顺序工作流
    Technical diagrams for SharePoint 2013
    To get TaskID's Integer ID value from the GUID in SharePoint workflow
    how to get sharepoint lookup value
  • 原文地址:https://www.cnblogs.com/google4y/p/2149131.html
Copyright © 2020-2023  润新知