• Linux查看配置文件中未被注释的有效配置行


    grep 命令示例——去掉注释

    $ grep -v "^#" /path/to/config/file
    $ grep -v "^#" /etc/apache2/apache2.conf

    示例输出:

    ServerRoot "/etc/apache2"
    LockFile /var/lock/apache2/accept.lock
    PidFile ${APACHE_PID_FILE}
    Timeout 300
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 15
    <IfModule mpm_prefork_module>
        StartServers          5
        MinSpareServers       5
        MaxSpareServers      10
        MaxClients          150
        MaxRequestsPerChild   0
    </IfModule>
    <IfModule mpm_worker_module>
        StartServers          2
        MinSpareThreads      25
        MaxSpareThreads      75
        ThreadLimit          64
        ThreadsPerChild      25
        MaxClients          150
        MaxRequestsPerChild   0
    </IfModule>
    <IfModule mpm_event_module>
        StartServers          2
        MaxClients          150
        MinSpareThreads      25
        MaxSpareThreads      75
        ThreadLimit          64
        ThreadsPerChild      25
        MaxRequestsPerChild   0
    </IfModule>
    User ${APACHE_RUN_USER}
    Group ${APACHE_RUN_GROUP}
    AccessFileName .htaccess
    <Files ~ "^.ht">
        Order allow,deny
        Deny from all
        Satisfy all
    </Files>
    DefaultType text/plain
    HostnameLookups Off
    ErrorLog /var/log/apache2/error.log
    LogLevel warn
    Include /etc/apache2/mods-enabled/*.load
    Include /etc/apache2/mods-enabled/*.conf
    Include /etc/apache2/httpd.conf
    Include /etc/apache2/ports.conf
    LogFormat "%v:%p %h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" vhost_combined
    LogFormat "%h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" combined
    LogFormat "%h %l %u %t "%r" %>s %O" common
    LogFormat "%{Referer}i -> %U" referer
    LogFormat "%{User-agent}i" agent
    CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined
    Include /etc/apache2/conf.d/
    Include /etc/apache2/sites-enabled/

    想要跳过其中的空行,可以使用 egrep 命令

    egrep -v "^#|^$" /etc/apache2/apache2.conf
  • 相关阅读:
    jquery ajax参数详解
    压缩解压函数实现
    WCF 大数据量如何从服务端传到客户端
    [DllImport("kernel32.dll")]
    Oracle数据库使用基础和实例
    Js常用的动态效果
    Js使用正则实现表单验证
    Oracle数据库理论知识
    HTML5,CSS3,JavaScript基础知识与使用
    速读《人月神话》
  • 原文地址:https://www.cnblogs.com/gange111/p/9582637.html
Copyright © 2020-2023  润新知