• Ubuntu下apache2启动、停止、重启、配置


    Linux系统为Ubuntu

    一、Start Apache 2 Server /启动apache服务
    # /etc/init.d/apache2 start
    or
    $ sudo /etc/init.d/apache2 start
    二、 Restart Apache 2 Server /重启apache服务
    # /etc/init.d/apache2 restart
    or
    $ sudo /etc/init.d/apache2 restart
    三、Stop Apache 2 Server /停止apache服务
    # /etc/init.d/apache2 stop
    or
    $ sudo /etc/init.d/apache2 stop

     配置

    1、在./etc/ 找到hosts文件,在hosts里面添加域名指向虚拟机IP地址 如
    192.168.**.**    video.xxx.com(命令行下ifconfig查看)

    2、创建自己的根目录:
    例如

     sudo mkdir /wwwroot 

    子目录

    sudo mkdir video

    3、在video目录下创建自己的主页

    sudo vi index.html

    4.进入./etc/apache2/sites-available复制默认文件:

    sudo cp 000-default.conf  video.conf

    5.修改vide.conf  

    sudo vi video.conf

    将DocumentRoot 后面的目录改为/wwwroot/video
    在ServerAdmin上一行加入
    ServerName video.imooc.com


    6.修改apache2.conf
    增加

    <Directory /wwwroot/video/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
    </Directory>

    7.建立软连接
    进入/etc/apache2/sites-enabled 目录下打开命令行工具

    sudo ln -s ../sites-available/video.conf video.conf

    8.重启Apache2:

    /etc/init.d/apache2 restart

    9.在浏览器输入video.xxx.com 会出现你创建的index.html内容

    参考http://blog.csdn.net/lsmrsun/article/details/51593926

  • 相关阅读:
    所有程序员都是自学成才
    Xcode6模拟器路径
    Xcode7中模拟器的位置
    数据结构中的二级指针和引用
    02_线性表的链式表示和实现
    Spring 单例 httprequest 线程安全
    Springboot listener
    Spring单例 和 Scope注解
    红黑树
    线程池
  • 原文地址:https://www.cnblogs.com/ricksteves/p/12258861.html
Copyright © 2020-2023  润新知