




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、 HTTP服务配置一、下载版本1、解压 # cd /opt/software# tar zxvf http2.2.tar.gz2、配置 # cd /opt/software/ http2.2#./configure -prefix=/usr/local/http2.23、编译#make4、安装#make install5、配置文件#vi /usr/local/http2.2/conf/httpd.conf6、启动#/usr/local/http2.2/bin/apachectl -k start二、Linux 自带http服务配置文件# This is the main Apache serv
2、er configuration file. It contains the# configuration directives that give the server its instructions.# See <URL:/docs/2.2/> for detailed information.# In particular, see# <URL:/docs/2.2/mod/directives.html># for a discussion of each configura
3、tion directive.# Do NOT simply read the instructions in here without understanding# what they do. They're here only as hints or reminders. If you are unsure# consult the online docs. You have been warned. # The configuration directives are grouped into three basic sections:# 1. Directives that c
4、ontrol the operation of the Apache server process as a# whole (the 'global environment').# 2. Directives that define the parameters of the 'main' or 'default' server,# which responds to requests that aren't handled by a virtual host.# These directives also provide default
5、 values for the settings# of all virtual hosts.# 3. Settings for virtual hosts, which allow Web requests to be sent to# different IP addresses or hostnames and have them handled by the# same Apache server process.# Configuration and logfile names: If the filenames you specify for many# of the server
6、's control files begin with "/" (or "drive:/" for Win32), the# server will use that explicit path. If the filenames do *not* begin# with "/", the value of ServerRoot is prepended - so "logs/foo.log"# with ServerRoot set to "/etc/httpd" will be in
7、terpreted by the# server as "/etc/httpd/logs/foo.log".# Section 1: Global Environment# The directives in this section affect the overall operation of Apache,# such as the number of concurrent requests it can handle or where it# can find its configuration files.# Don't give away too muc
8、h information about all the subcomponents# we are running. Comment out this line if you don't mind remote sites# finding out what major optional modules you are runningServerTokens OS /当服务器响应主机头(header)信息时显示Apache的版本和操作系统名称# ServerRoot: The top of the directory tree under which the server's#
9、 configuration, error, and log files are kept.# NOTE! If you intend to place this on an NFS (or otherwise network)# mounted filesystem then please read the LockFile documentation# (available at <URL:/docs/2.2/mod/mpm_common.html#lockfile>);# you will save yourself a lot o
10、f trouble.# Do NOT add a slash at the end of the directory path.ServerRoot "/etc/httpd" /设置服务器的根目录# PidFile: The file in which the server should record its process# identification number when it starts.#PidFile run/httpd.pid /设置运行Apache时使用的PidFile的路径# Timeout: The number of seconds before
11、receives and sends time out.#Timeout 120 /若120秒后没有收到或送出任何数据就切断该连接# KeepAlive: Whether or not to allow persistent connections (more than# one request per connection). Set to "Off" to deactivate.#KeepAlive Off /不使用保持连接的功能,即客户一次请求连接只能响应一个文件/建议用户将此参数的值设置为On,即允许使用保持连接的功能# MaxKeepAliveRequests:
12、The maximum number of requests to allow# during a persistent connection. Set to 0 to allow an unlimited amount.# We recommend you leave this number high, for maximum performance.#MaxKeepAliveRequests 100 /在使用保持连接功能时,设置客户一次请求连接能响应文件的最大上限# KeepAliveTimeout: Number of seconds to wait for the next reque
13、st from the# same client on the same connection.#KeepAliveTimeout 15 /在使用保持连接功能时,两个相邻的连接的时间间隔超过15秒,就切断连接#Server-Pool Size Regulation (MPM specific)# # prefork MPM# StartServers: number of server processes to start# MinSpareServers: minimum number of server processes which are kept spare# MaxSpareSer
14、vers: maximum number of server processes which are kept spare# ServerLimit: maximum value for MaxClients for the lifetime of the server# MaxClients: maximum number of server processes allowed to start# MaxRequestsPerChild: maximum number of requests a server process serves/设置使用Prefork MPM运行方式的参
15、数,此运行方式是Red hat默认的方式<IfModule prefork.c>StartServers 8 /设置服务器启动时运行的进程数MinSpareServers 5 /Apache在运行时会根据负载的轻重自动调整空闲子进程的数目/若存在低于5个空闲子进程,就创建一个新的子进程准备为客户提供服务MaxSpareServers 20 /若存在高于20个空闲子进程,就创建逐一删除子进程来提高系统性能ServerLimit 256 MaxClients 256 /限制同一时间的连接数不能超过256MaxRequestsPerChild 4000 /限制每个子进程在结束处
16、理请求之前能处理的连接请求为4000</IfModule># worker MPM# StartServers: initial number of server processes to start# MaxClients: maximum number of simultaneous client connections# MinSpareThreads: minimum number of worker threads which are kept spare# MaxSpareThreads: maximum number of worker threads which a
17、re kept spare# ThreadsPerChild: constant number of worker threads in each server process# MaxRequestsPerChild: maximum number of requests a server process serves/设置使用perchild MPM运行方式的参数<IfModule worker.c>StartServers 2MaxClients 150MinSpareThreads 25MaxSpareThreads 75 ThreadsPerChild 25Ma
18、xRequestsPerChild 0</IfModule># Listen: Allows you to bind Apache to specific IP addresses and/or# ports, in addition to the default. See also the <VirtualHost># directive.# Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP
19、addresses ()#Listen 8:80Listen 90 /设置服务器的监听端口# Dynamic Shared Object (DSO) Support /动态加载模块(DSO)# To be able to use the functionality of a module which was built as a DSO you# have to place corresponding LoadModule' lines at this location so the# directives contained in it are ac
20、tually available _before_ they are used.# Statically compiled modules (those listed by httpd -l') do not need# to be loaded here.# Example:# LoadModule foo_module modules/mod_foo.so#LoadModule auth_basic_module modules/mod_auth_basic.soLoadModule auth_digest_module modules/mod_auth_digest.soLoad
21、Module authn_file_module modules/mod_authn_file.soLoadModule authn_alias_module modules/mod_authn_alias.soLoadModule authn_anon_module modules/mod_authn_anon.soLoadModule authn_dbm_module modules/mod_authn_dbm.soLoadModule authn_default_module modules/mod_authn_default.soLoadModule authz_host_module
22、 modules/mod_authz_host.soLoadModule authz_user_module modules/mod_authz_user.soLoadModule authz_owner_module modules/mod_authz_owner.soLoadModule authz_groupfile_module modules/mod_authz_groupfile.soLoadModule authz_dbm_module modules/mod_authz_dbm.soLoadModule authz_default_module modules/mod_auth
23、z_default.soLoadModule ldap_module modules/mod_ldap.soLoadModule authnz_ldap_module modules/mod_authnz_ldap.soLoadModule include_module modules/mod_include.soLoadModule log_config_module modules/mod_log_config.soLoadModule logio_module modules/mod_logio.soLoadModule env_module modules/mod_env.soLoad
24、Module ext_filter_module modules/mod_ext_filter.soLoadModule mime_magic_module modules/mod_mime_magic.soLoadModule expires_module modules/mod_expires.soLoadModule deflate_module modules/mod_deflate.soLoadModule headers_module modules/mod_headers.soLoadModule usertrack_module modules/mod_usertrack.so
25、LoadModule setenvif_module modules/mod_setenvif.soLoadModule mime_module modules/mod_mime.soLoadModule dav_module modules/mod_dav.soLoadModule status_module modules/mod_status.soLoadModule autoindex_module modules/mod_autoindex.soLoadModule info_module modules/mod_info.soLoadModule dav_fs_module mod
26、ules/mod_dav_fs.soLoadModule vhost_alias_module modules/mod_vhost_alias.soLoadModule negotiation_module modules/mod_negotiation.soLoadModule dir_module modules/mod_dir.soLoadModule actions_module modules/mod_actions.soLoadModule speling_module modules/mod_speling.soLoadModule userdir_module modules/
27、mod_userdir.soLoadModule alias_module modules/mod_alias.soLoadModule rewrite_module modules/mod_rewrite.soLoadModule proxy_module modules/mod_proxy.soLoadModule proxy_balancer_module modules/mod_proxy_balancer.soLoadModule proxy_ftp_module modules/mod_proxy_ftp.soLoadModule proxy_http_module modules
28、/mod_proxy_http.soLoadModule proxy_connect_module modules/mod_proxy_connect.soLoadModule cache_module modules/mod_cache.soLoadModule suexec_module modules/mod_suexec.soLoadModule disk_cache_module modules/mod_disk_cache.soLoadModule file_cache_module modules/mod_file_cache.soLoadModule mem_cache_mod
29、ule modules/mod_mem_cache.soLoadModule cgi_module modules/mod_cgi.soLoadModule version_module modules/mod_version.so# The following modules are not loaded by default:#LoadModule cern_meta_module modules/mod_cern_meta.so#LoadModule asis_module modules/mod_asis.so# Load config files from the config di
30、rectory "/etc/httpd/conf.d"./将/etc/httpd/conf.d目录下所有以conf结尾的配置文件包含进来Include conf.d/*.conf# ExtendedStatus controls whether Apache will generate "full" status# information (ExtendedStatus On) or just basic information (ExtendedStatus# Off) when the "server-status" handle
31、r is called. The default is Off.#ExtendedStatus On# If you wish httpd to run as a different user or group, you must run# httpd as root initially and it will switch. # User/Group: The name (or #number) of the user/group to run httpd as.# . On SCO (ODT 3) use "User nouser" and "Group no
32、group".# . On HPUX you may not be able to use shared memory as nobody, and the# suggested workaround is to create a user www and use that user.# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)# when the value of (unsigned)Group is above 60000; # don't use Group #-1 on thes
33、e systems!/设置运行Apache服务器的用户和组User apacheGroup apache# Section 2: 'Main' server configuration# The directives in this section set up the values used by the 'main'# server, which responds to any requests that aren't handled by a# <VirtualHost> definition. These values also pr
34、ovide defaults for# any <VirtualHost> containers you may define later in the file.# All of these directives may appear inside <VirtualHost> containers,# in which case these default settings will be overridden for the# virtual host being defined.# ServerAdmin: Your address, where problems
35、 with the server should be# e-mailed. This address appears on some server-generated pages, such# as error documents. e.g. adminyour-/设置Apache服务器管理员的E_mail地址ServerAdmin rootlocalhost# ServerName gives the name and port that the server uses to identify itself.# This can often be determined automatical
36、ly, but we recommend you specify# it explicitly to prevent problems during startup.# If this is not set to valid DNS name for your host, server-generated# redirections will not work. See also the UseCanonicalName directive.# If your host doesn't have a registered DNS name, enter its IP address h
37、ere.# You will have to access it by its address anyway, and this will make # redirections work in a sensible way.#ServerName :80 ServerName 0# UseCanonicalName: Determines how Apache constructs self-referencing # URLs and the SERVER_NAME and SERVER_PORT variables.# When set "Off&quo
38、t;, Apache will use the Hostname and Port supplied# by the client. When set "On", Apache will use the value of the# ServerName directive./关闭此选项,当Apache服务器需要指向本身的连接时使用/serverName:port作为主机名,例如:80/若打开此选项将使用 port 80作为主机名UseCanonicalName Off# DocumentRoot: The directory out of which you wi
39、ll serve your# documents. By default, all requests are taken from this directory, but# symbolic links and aliases may be used to point to other locations./设置根文档路径DocumentRoot "/var/www/html" # Each directory to which Apache has access can be configured with respect# to which services and f
40、eatures are allowed and/or disabled in that# directory (and its subdirectories). # First, we configure the "default" to be a very restrictive set of # features. /设置apache服务器根的访问权限<Directory /> Options FollowSymLinks /允许符号链接跟随,访问不在本目录下的文件 AllowOverride None /禁止读取.htaccess配置文件的内容</D
41、irectory># Note that from this point forward you must specifically allow# particular features to be enabled - so if something's not working as# you might expect, make sure that you have specifically enabled it# below.# This should be changed to whatever you set DocumentRoot to./设置根文档目录的访问权限&l
42、t;Directory "/var/www/html"># Possible values for the Options directive are "None", "All",# or any combination of:# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews# Note that "MultiViews" must be named *explicitly* - "Options Al
43、l"# doesn't give it to you.# The Options directive is both complicated and important. Please see# /docs/2.2/mod/core.html#options# for more information./Indexes:当在目录中找不到DirectoryIndex列表中指定的文件就生成当前目录的文件列表/FollowSymLinks允许符号链接跟随,访问不在本目录下的文件 Options Indexes FollowSymLinks
44、# AllowOverride controls what directives may be placed in .htaccess files.# It can be "All", "None", or any combination of the keywords:# Options FileInfo AuthConfig Limit AllowOverride None /禁止读取.htaccess配置文件的内容 # Controls who can get stuff from this server.# Or
45、der allow,deny /指定先执行Allow(允许)访问规则,在执行Deny访问规则 Allow from all /设置Allow(允许)访问规则,允许所有连接</Directory># UserDir: The name of the directory that is appended onto a user's home# directory if a user request is received.# The path to the end user account 'public_html' directory must be# acc
46、essible to the webserver userid. This usually means that userid# must have permissions of 711, userid/public_html must have permissions# of 755, and documents contained therein must be world-readable.# Otherwise, the client will only receive a "403 Forbidden" message.# See also: http:/http
47、/docs/misc/FAQ.html#forbidden/不允许每用户的服务器配置<IfModule mod_userdir.c> # UserDir is disabled by default since it can confirm the presence # of a username on the system (depending on home directory # permissions). UserDir disable /不允许每用户的服务器配置 #/基于安全考虑,禁止root用户使用自己的个人站点 #Use
48、rDir disable root # To enable requests to /user/ to serve the user's public_html # directory, remove the "UserDir disable" line above, and uncomment # the following line instead: #/配置对每个用户web站点目录的设置 #UserDir public_html</IfModule># Control access to UserDir directories.
49、 The following is an example# for a site where these directories are restricted to read-only./设置对每个用户web站点目录的访问权限#<Directory /home/*/public_html># AllowOverride FileInfo AuthConfig Limit# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec# <Limit GET POST OPTIONS># Order allo
50、w,deny# Allow from all# </Limit># <LimitExcept GET POST OPTIONS># Order deny,allow# Deny from all# </LimitExcept>#</Directory># DirectoryIndex: sets the file that Apache will serve if a directory# is requested.# The index.html.var file (a type-map) is used to deliver content-
51、# negotiated documents. The MultiViews Option can be used for the # same purpose, but it is much slower.#/当访问服务器时,依次查找页面Index.html index.htm.varDirectoryIndex index.html index.html.var# AccessFileName: The name of the file to look for in each directory# for additional configuration directives.
52、See also the AllowOverride# directive.#/指定保护目录配置文件的名称AccessFileName .htaccess# The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. #/拒绝访问以.ht开头的文件,即保证.htaccess不被访问<Files ".ht"> Order allow,deny Deny from all</Files># TypesConfig describ
53、es where the mime.types file (or equivalent) is# to be found.#/指定负责处理MIME对应格式的配置文件的存放位置TypesConfig /etc/mime.types# DefaultType is the default MIME type the server will use for a document# if it cannot otherwise determine one, such as from filename extensions.# If your server contains mostly text or
54、 HTML documents, "text/plain" is# a good value. If most of your content is binary, such as applications# or images, you may want to use "application/octet-stream" instead to# keep browsers from trying to display binary files as though they are# text.#/指定默认的MIME文件类型为纯文本或HTML文件Defa
55、ultType text/plain# The mod_mime_magic module allows the server to use various hints from the# contents of the file itself to determine its type. The MIMEMagicFile# directive tells the module where the hint definitions are located.#/当mod_mime_magic.c模块被加载时,指定magic信息码配置文件的存放位置<IfModule mod_mime_ma
56、gic.c># MIMEMagicFile /usr/share/magic.mime MIMEMagicFile conf/magic</IfModule># HostnameLookups: Log the names of clients or just their IP addresses# e.g., (on) or 32 (off).# The default is off because it'd be overall better for the net if people# had to know
57、ingly turn this feature on, since enabling it means that# each client request will result in AT LEAST one lookup request to the# nameserver.#/只记录连接Apache服务器的Ip地址,而不纪录主机名HostnameLookups Off# EnableMMAP: Control whether memory-mapping is used to deliver# files (assuming that the underlying OS supports
58、 it).# The default is on; turn this off if you serve from NFS-mounted # filesystems. On some systems, turning it off (regardless of# filesystem) can improve performance; for details, please see# /docs/2.2/mod/core.html#enablemmap#EnableMMAP off# EnableSendfile: Control whether the sen
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 日刊类多色印刷品企业县域市场拓展与下沉战略研究报告
- 2025年插拔力试验机合作协议书
- 包子外卖加盟合同模板
- 游戏美术资源开发与制作合同
- 健康医疗信息平台设计与推广合作协议
- 药物临床试验协议
- 2025-2030年中国高频头行业运行动态及前景趋势分析报告
- 2025-2030年中国铁水脱硫喷枪市场运行现状及发展趋势预测报告
- 2025-2030年中国钢丝编织胶管产业运行状况与前景趋势分析报告
- 汽车修理劳动合同
- 弱电系统巡查记录表(办公楼)
- 预防接种人员岗位培训习题(Ⅰ类培训练习题库共385题)
- 现场经济签证单范本
- 《网店运营与管理》课件(完整版)
- 《跨境电商B2B操作实务》教学大纲
- 河口区自然资源
- 精益改善项目管理制度
- 2012数据结构英文试卷A及答案
- 服装购销合同最新版
- 机翼结构(课堂PPT)
- 二次回路施工验收
评论
0/150
提交评论