zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    1.1 Recruitment 1.1.4 Sample Test(II)
    1.1 Recruitment 1.1.4 Sample Test(I)
    微信登录接口
    谷歌浏览器保留页面跳转前的请求
    积分墙项目接口文档
    @SneakyThrows
    security中使用单元测试
    Prometheus监控系统
    大数据-shell-脚本入门-开头格式、运行方式、多命令处理
    大数据-shell-概述
  • 原文地址:https://www.cnblogs.com/ricksteves/p/12258861.html
Copyright © 2011-2022 走看看