zoukankan      html  css  js  c++  java
  • Httpd服务入门知识-Httpd服务常见配置案例之定义'Main' server的文档页面路径(文档根路径)

          Httpd服务入门知识-Httpd服务常见配置案例之定义'Main' server的文档页面路径(文档根路径) 

                                                    作者:尹正杰

    版权声明:原创作品,谢绝转载!否则将追究法律责任。

    一.创建测试文件

    [root@node101.yinzhengjie.org.cn ~]# mkdir -pv /data/www/html
    mkdir: created directory ‘/data/www’
    mkdir: created directory ‘/data/www/html’
    [root@node101.yinzhengjie.org.cn ~]# 
    [root@node101.yinzhengjie.org.cn ~]# echo "/data/www/html" > /data/www/html/index.html
    [root@node101.yinzhengjie.org.cn ~]# 
    [root@node101.yinzhengjie.org.cn ~]# ll /data/www/html/
    total 4
    -rw-r--r-- 1 root root 15 Dec  7 20:07 index.html
    [root@node101.yinzhengjie.org.cn ~]# 

    二.修改根目录路径

    1>.编辑“DocumentRoot ”指令的值

    [root@node101.yinzhengjie.org.cn ~]# egrep -v "^ *#|^$" /etc/httpd/conf/httpd.conf  | grep DocumentRoot
    DocumentRoot "/var/www/html"
    [root@node101.yinzhengjie.org.cn ~]# 
    [root@node101.yinzhengjie.org.cn ~]# vim /etc/httpd/conf/httpd.conf
    [root@node101.yinzhengjie.org.cn ~]# 
    [root@node101.yinzhengjie.org.cn ~]# egrep -v "^ *#|^$" /etc/httpd/conf/httpd.conf  | grep DocumentRoot
    DocumentRoot "/data/www/html"
    [root@node101.yinzhengjie.org.cn ~]# 
    [root@node101.yinzhengjie.org.cn ~]# 

    2>.给自定义的"DocumentRoot"指令指定的目录授权(若不执行该步骤客户端将无法访问"/data/www/html"目录下的文件哟~)

    [root@node101.yinzhengjie.org.cn ~]# cat /etc/httpd/conf.d/document_root.conf
    <Directory "/data/www/html">
        Require all granted
    </Directory>
    [root@node101.yinzhengjie.org.cn ~]# 
    [root@node101.yinzhengjie.org.cn ~]# httpd -t
    Syntax OK
    [root@node101.yinzhengjie.org.cn ~]# 
    [root@node101.yinzhengjie.org.cn ~]# systemctl restart httpd
    [root@node101.yinzhengjie.org.cn ~]# 

    3>.测试客户端是否正常访问

  • 相关阅读:
    蓝牙的HFP协议笔记
    23种设计模式
    读QT5.7源码(三)Q_OBJECT 和QMetaObject
    实现私有化(Pimpl) --- QT常见的设计模式
    蓝牙Profile的概念和常见种类(转)
    git分支合并
    git log的常见用法
    QThread详解
    git查看某个文件的修改历史
    因为代理原因导致的NotSerializableException
  • 原文地址:https://www.cnblogs.com/yinzhengjie/p/12002663.html
Copyright © 2011-2022 走看看