zoukankan      html  css  js  c++  java
  • Apache 搭建虚拟主机

    Apache 搭建虚拟主机方法

    DocumentRoot: /home/fdipzone/sites/demo.fdipzone.com
    ServerName:demo.fdipzone.com

    1.进入apache虚拟主机设置目录

    cd /etc/apache2/sites-available

    2.创建文件demo.fdipzone.com

    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /home/fdipzone/sites/demo.fdipzone.com
            ServerName demo.fdipzone.com
            ServerAlias demo.fdipzone.com
            <Directory "/home/fdipzone/sites/demo.fdipzone.com">
                    allow from all Options + Indexes
            </Directory>
    </VirtualHost>
    
    3.激活虚拟主机配置
    sudo a2ensite demo.fdipzone.com
    4.进入 /etc/apache2/sites-enabled/目录,可以查看所有激活的虚拟主机。可以用 sudo a2dissite demo.fdipzone.com 注销

    cd /etc/apache2/sites-enabled
    ls -lt
    显示
    lrwxrwxrwx 1 root root 36 2013-04-05 17:29 demo.fdipzone.com -> ../sites-available/demo.fdipzone.com
    5.重启apache服务
    sudo /etc/init.d/apache2 restart
    6.ubuntu 设置host
    vim /etc/hosts
    127.0.0.1 demo.fdipzone.com
    7.<Directory>设置开启.htaccess与显示目录结构列表
    <Directory "/home/fdipzone/demo.fdipzone.com">
    AllowOverride none
    AllowOverride all
    Options -Index FollowSymLinks
    </Directory>
    AllowOverride none 表示关闭.htaccess,如要开启可设置为AllowOverride all
    Options -Indexes 表示关闭目录结构显示,如要开启可设置为 Options Indexes
    Options FollowSymLinks 表示支持symbol link(软连接),如要关闭可设置为Options -FollowSymLinks


  • 相关阅读:
    快速整理sql表结构到wiki
    mac subline批量处理行
    iphone7忘记手机屏幕密码
    docker 常用命令
    初窥响应式布局
    用jquery写的一个图片轮播插件
    javascript中的对象和创建对象的主要模式
    用户注册界面(带js特效)
    用javascript实现简易留言板
    用javascript实现的购物车实例
  • 原文地址:https://www.cnblogs.com/fdipzone/p/3715127.html
Copyright © 2011-2022 走看看