• Apache主要的配置文件们


    httpd.conf
    ServerRoot 
    设定服务器的根目录
    Listen 
    端口号
    User && Group 
    指定服务器用来响应请求的用户ID和组ID
    ServerAdmin 
    管理员的邮箱
    ServerName 
    设定服务器的主机名称
    [ServerName www.example.com:80]
    DocumentRoot 
    设置Apache提供文件服务的目录
    Options 
    目录所能使用的服务器功能;[ Options Indexes FollowSymLinks  ]
    None:表示只能浏览,
       FollowSymLinks:允许页面连接到别处,
       ExecCGI:允许执行CGI,
       MultiViews:允许看动画或是听音乐之类的操作,
       Indexes:允许服务器返回目录的格式化列表,
       Includes:允许使用SSI。这些设置可以复选。
       All:则可以做任何事,但不包括MultiViews。
       AllowOverride:加None参数表示任何人都可以浏览该目录下的文件。
       另外的参数有:FileInfo、AuthConfig、Limit。
    AllowOverride [AllowOverride None]
    Require

    客户端访问限制2.4版本

    [Require all granted] 允许所有

    <IfModule>
    使用不包含在Apache安装中的模块的命令

    <Files ".ht*">
        Require all denied
    </Files>

     
    ErrorLog
    LogLevel

    debug 、info 、notice 、warn 、error 、crit 、alert、amerg 系统快要死了
    [ErrorLog "logs/error_log"]
    [LogLevel warn]

     
    httpd-mpm.conf

    [root@centos1 bin]# apachectl -l
    Compiled in modules:
      core.c
      mod_so.c
      http_core.c
      worker.c

    # prefork MPM

    <IfModule mpm_prefork_module>
        StartServers             5
        MinSpareServers          5
        MaxSpareServers         10
        MaxRequestWorkers      250
        MaxConnectionsPerChild   0
    </IfModule>

    perfork模式:使用单独的子进程来处理每个请求
    # StartServers: 服务启动时建立的server进程数
    # MinSpareServers: 空闲server进程的最小数
    # MaxSpareServers: 空闲server进程的最大数
    # MaxRequestWorkers: 允许启动的最大server进程数
    # MaxConnectionsPerChild: 每个server进程在生存期允许伺服的最大请求数

    # worker MPM
    <IfModule mpm_worker_module>
        StartServers             3
        MinSpareThreads         75
        MaxSpareThreads        250
        ThreadsPerChild         25
        MaxRequestWorkers      400
        MaxConnectionsPerChild   0
    </IfModule>

    # worker MPM
    # StartServers: 服务启动时建立的server进程数
    # MinSpareThreads: 空闲的工作线程最小数
    # MaxSpareThreads: 空闲的工作线程最大数
    # ThreadsPerChild: 每个进程可建立的工作线程数
    # MaxRequestWorkers: 最大的工作线程数
    # MaxConnectionsPerChild:每个sever进程生存期允许伺服的最大请求数

    worker模式由于使用线程来进行处理请求,所以能够处理海量请求,而系统资源的开销要小于基于进程的服务器.同时worker模式也使用了多进程,每个进程又有着多个线程,以获得基于进程服务器的稳定性.

    # event MPM

    <IfModule mpm_event_module>
        StartServers             3
        MinSpareThreads         75
        MaxSpareThreads        250
        ThreadsPerChild         25
        MaxRequestWorkers      400
        MaxConnectionsPerChild   0
    </IfModule>

    # event MPM
    # StartServers: initial number of server processes to start
    # MinSpareThreads: minimum number of worker threads which are kept spare
    # MaxSpareThreads: maximum number of worker threads which are kept spare
    # ThreadsPerChild: constant number of worker threads in each server process
    # MaxRequestWorkers: maximum number of worker threads
    # MaxConnectionsPerChild: maximum number of connections a server process serves before terminating

    # NetWare MPM
    <IfModule mpm_netware_module>
        ThreadStackSize      65536
        StartThreads           250
        MinSpareThreads         25
        MaxSpareThreads        250
        MaxThreads            1000
        MaxConnectionsPerChild   0
    </IfModule>

    # NetWare MPM
    # ThreadStackSize: Stack size allocated for each worker thread
    # StartThreads: Number of worker threads launched at server startup
    # MinSpareThreads: Minimum number of idle threads, to handle request spikes
    # MaxSpareThreads: Maximum number of idle threads
    # MaxThreads: Maximum number of worker threads alive at the same time
    # MaxConnectionsPerChild: Maximum  number of connections a thread serves. It is recommended that the default value of 0 be set for this directive on NetWare.  This will allow the thread to continue to service requests indefinitely.

    # OS/2 MPM

    <IfModule mpm_mpmt_os2_module>
        StartServers             2
        MinSpareThreads          5
        MaxSpareThreads         10
        MaxConnectionsPerChild   0
    </IfModule>

    # OS/2 MPM
    # StartServers: Number of server processes to maintain
    # MinSpareThreads: Minimum number of idle threads per process, to handle request spikes MaxSpareThreads: Maximum number of idle threads per process MaxConnectionsPerChild: Maximum number of connections per server process

    # WinNT MPM
    <IfModule mpm_winnt_module>
        ThreadsPerChild        150
        MaxConnectionsPerChild   0
    </IfModule>

    # WinNT MPM
    # ThreadsPerChild: constant number of worker threads in the server process
    # MaxConnectionsPerChild: maximum number of connections a server process serves

       
       
     
    httpd-vhosts.conf

    <VirtualHost *:80>
        ServerAdmin webmaster@dummy-host.example.com
        DocumentRoot "/usr/local/apache2/docs/dummy-host.example.com"
        ServerName dummy-host.example.com
        ServerAlias www.dummy-host.example.com
        ErrorLog "logs/dummy-host.example.com-error_log"
        CustomLog "logs/dummy-host.example.com-access_log" common
    </VirtualHost>

    虚拟主机的配置文件
     
    httpd-info.conf

    <Location /server-status>
        SetHandler server-status
        Require host .example.com
        Require ip 127
    </Location>

     
     
    proxy-html.conf

    ProxyHTMLLinks  a               href
    ProxyHTMLLinks  area            href
    ProxyHTMLLinks  link            href
    ProxyHTMLLinks  img             src longdesc usemap
    ProxyHTMLLinks  object          classid codebase data usemap
    ProxyHTMLLinks  q               cite
    ProxyHTMLLinks  blockquote      cite
    ProxyHTMLLinks  ins             cite
    ProxyHTMLLinks  del             cite
    ProxyHTMLLinks  form            action
    ProxyHTMLLinks  input           src usemap
    ProxyHTMLLinks  head            profile
    ProxyHTMLLinks  base            href
    ProxyHTMLLinks  script          src for

     

    ProxyHTMLEvents onclick ondblclick onmousedown onmouseup
                    onmouseover onmousemove onmouseout onkeypress
                    onkeydown onkeyup onfocus onblur onload
                    onunload onsubmit onreset onselect onchange

     

    # ProxyRequests Off  <-- this is an important security setting
    # ProxyPass /my-gateway/ http://some.app.intranet/
    # <Location /my-gateway/>
    #       ProxyPassReverse /
    #       ProxyHTMLEnable On
    #       ProxyHTMLURLMap http://some.app.intranet/ /my-gateway/
    #       ProxyHTMLURLMap / /my-gateway/
    # </Location>

     
       
     
    httpd-ssl.conf    
    httpd-dav.conf

    DavLockDB "/usr/local/apache2/var/DavLock"

    Alias /uploads "/usr/local/apache2/uploads"

    <Directory "/usr/local/apache2/uploads">
        Dav On

        AuthType Digest
        AuthName DAV-upload
        dmin
        AuthUserFile "/usr/local/apache2/user.passwd"
        AuthDigestProvider file

       
     
        <RequireAny>
            Require method GET POST OPTIONS
            Require user admin
        </RequireAny>
    </Directory>

     
       
     
    httpd-manual.conf    
    httpd-userdir.conf

    UserDir public_html

    #
    # Control access to UserDir directories.  The following is an example
    # for a site where these directories are restricted to read-only.
    #
    <Directory "/home/*/public_html">
        AllowOverride FileInfo AuthConfig Limit Indexes
        Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
        Require method GET POST OPTIONS
    </Directory>

     
    httpd-multilang-errordoc.conf    
    httpd-languages.conf    
    httpd-default.conf Timeout 60
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 5
    UseCanonicalName Off
    AccessFileName .htaccess
    ServerTokens Full
    ServerSignature Off
    HostnameLookups Off
     keepalive减少tcp连接数
    httpd-autoindex.conf    
  • 相关阅读:
    svn使用教程
    事务的隔离级别--全网最详细
    idea的java类图标C不见,取而代之是J标识,且写代码无提示
    text .global_start 和_start
    transformClassesWithDexForDebug
    RxJava基本流程和lift源码分析
    Rxlifecycle(三):坑
    Rxlifecycle(二):源码解析
    RxJava操作符之Share, Publish, Refcount
    Rxlifecycle(一):使用
  • 原文地址:https://www.cnblogs.com/stay-sober/p/4207785.html
Copyright © 2020-2023  润新知