zoukankan      html  css  js  c++  java
  • Ubuntu 12.04 之 虚拟主机的配置

    Ubuntu 12.04 之 虚拟主机的配置


     

    (1)打开etc/hosts文件

    增加:

    127.0.0.1 study.ubuntu.com

    127.0.0.1 hello.ubuntu.com

    127.0.0.1 test.ubuntu.com


    (2)建立三个项目目录

    sudo mkdir -p /wwwroot/{study,hello,test}

    在每个项目里都建立一个Index.html


    (3)配置apache的虚拟主机

    切换到apache的配置目录:

    cd /etc/apache2/sites-available/

    复制三份配置文件:

    sudo cp default study
    sudo cp default hello
    sudo cp default test

    修改配置文件:

    vim hello

    内容:

      ServerName hello.ubuntu.com 添加

      DocumentRoot /wwwroot/hello 修改

      <Directory /wwwroot/hello/>  修改

    启动配置文件:

    test@localhost:/etc/apache2/sites-available$ cd ../sites-enabled/
    test@localhost:/etc/apache2/sites-enabled$ ll
    ls: 初始化月份字符串出错
    总用量 8
    drwxr-xr-x 2 root root 409619 14:22 ./
    drwxr-xr-x 7 root root 409619 14:23 ../
    lrwxrwxrwx 1 root root   2619 14:22 000-default -> ../sites-available/default
    test@localhost:/etc/apache2/sites-enabled$ 

    需要分别创建三个软连接,分别指向刚才复制的三个配置文件。

    sudo ln -s ../sites-available/hello hello
    sudo ln -s ../sites-available/test test
    sudo ln -s ../sites-available/study study

    重启apache:sudo service apache2 restart

    然后就可以访问

    hello.ubuntu.com

    study.ubuntu.com

    test.ubuntu.com


  • 相关阅读:
    12.13 Redis缓存面试题精简版
    12.12 Oracle数据库相关面试题精简版(后续继续完善)
    1.131 IDEA2018版本64位激活
    7.11 读《如何阅读一本书》有感
    Linux下source命令详解(转载)
    Scala 随笔
    SparkStreaming实时流式大数据处理实战总结
    转载:hive的一些udaf
    IDEA的一些常见报错
    hive使用UDF函数
  • 原文地址:https://www.cnblogs.com/gyfluck/p/9336695.html
Copyright © 2011-2022 走看看