1、Linux中HTTP服务配置 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 ma
2、in Apache server configuration file. It contains the# configuration directives that give the server its instructions.# See for detailed information.# In particular, see# # for a discussion of each configuration directive.# Do NOT simply read the instructions in here without understanding# what they
3、do. Theyre 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 control the operation of the Apache server process as a# whole (the global environment).# 2. Directi
4、ves that define the parameters of the main or default server,# which responds to requests that arent handled by a virtual host.# These directives also provide default values for the settings# of all virtual hosts.# 3. Settings for virtual hosts, which allow Web requests to be sent to# different IP a
5、ddresses 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 servers control files begin with / (or drive:/ for Win32), the# server will use that explicit path. If the filenames do *not* begin# with /,
6、 the value of ServerRoot is prepended - so logs/foo.log# with ServerRoot set to /etc/httpd will be interpreted 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
7、it can handle or where it# can find its configuration files.# Dont give away too much information about all the subcomponents# we are running. Comment out this line if you dont mind remote sites# finding out what major optional modules you are runningServerTokens OS /当服务器响应主机头(header)信息时显示Apache的版本和
8、操作系统名称# ServerRoot: The top of the directory tree under which the servers# 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 );# you will save yourself a lot
9、 of 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 receives a
10、nd 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: The maximum number of
11、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 request from the# same clie
12、nt 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# MaxSpareServers: maximum number o
13、f 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/设置使用PreforkMPM运行方式的参数,此运行方式是Redhat默认的方式StartServ
14、ers 8 /设置服务器启动时运行的进程数MinSpareServers 5 /Apache在运行时会根据负载的轻重自动调整空闲子进程的数目/若存在低于5个空闲子进程,就创建一个新的子进程准备为客户提供服务MaxSpareServers 20 /若存在高于20个空闲子进程,就创建逐一删除子进程来提高系统性能ServerLimit 256 MaxClients 256 /限制同一时间的连接数不能超过256MaxRequestsPerChild 4000 /限制每个子进程在结束处理请求之前能处理的连接请求为4000# worker MPM# StartServers: initial number
15、 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 are kept spare# ThreadsPerChild: constant number of worker threads in each ser
16、ver process# MaxRequestsPerChild: maximum number of requests a server process serves/设置使用perchildMPM运行方式的参数StartServers 2MaxClients 150MinSpareThreads 25MaxSpareThreads 75 ThreadsPerChild 25MaxRequestsPerChild 0# Listen: Allows you to bind Apache to specific IP addresses and/or# ports, in addition t
17、o the default. See also the # directive.# Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)#Listen 12.34.56.78:80Listen 90 /设置服务器的监听端口# Dynamic Shared Object (DSO) Support /动态加载模块(DSO)# To be able to use the function
18、ality 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 actually available _before_ they are used.# Statically compiled modules (those listed by httpd -l) do not need# to be loaded here.# Example:# LoadModul
19、e foo_module modules/mod_foo.so#LoadModule auth_basic_module modules/mod_auth_basic.soLoadModule auth_digest_module modules/mod_auth_digest.soLoadModule authn_file_module modules/mod_authn_file.soLoadModule authn_alias_module modules/mod_authn_alias.soLoadModule authn_anon_module modules/mod_authn_a
20、non.soLoadModule authn_dbm_module modules/mod_authn_dbm.soLoadModule authn_default_module modules/mod_authn_default.soLoadModule authz_host_module modules/mod_authz_host.soLoadModule authz_user_module modules/mod_authz_user.soLoadModule authz_owner_module modules/mod_authz_owner.soLoadModule authz_g
21、roupfile_module modules/mod_authz_groupfile.soLoadModule authz_dbm_module modules/mod_authz_dbm.soLoadModule authz_default_module modules/mod_authz_default.soLoadModule ldap_module modules/mod_ldap.soLoadModule authnz_ldap_module modules/mod_authnz_ldap.soLoadModule include_module modules/mod_includ
22、e.soLoadModule log_config_module modules/mod_log_config.soLoadModule logio_module modules/mod_logio.soLoadModule env_module modules/mod_env.soLoadModule ext_filter_module modules/mod_ext_filter.soLoadModule mime_magic_module modules/mod_mime_magic.soLoadModule expires_module modules/mod_expires.soLo
23、adModule deflate_module modules/mod_deflate.soLoadModule headers_module modules/mod_headers.soLoadModule usertrack_module modules/mod_usertrack.soLoadModule setenvif_module modules/mod_setenvif.soLoadModule mime_module modules/mod_mime.soLoadModule dav_module modules/mod_dav.soLoadModule status_modu
24、le modules/mod_status.soLoadModule autoindex_module modules/mod_autoindex.soLoadModule info_module modules/mod_info.soLoadModule dav_fs_module modules/mod_dav_fs.soLoadModule vhost_alias_module modules/mod_vhost_alias.soLoadModule negotiation_module modules/mod_negotiation.soLoadModule dir_module mo
25、dules/mod_dir.soLoadModule actions_module modules/mod_actions.soLoadModule speling_module modules/mod_speling.soLoadModule userdir_module modules/mod_userdir.soLoadModule alias_module modules/mod_alias.soLoadModule rewrite_module modules/mod_rewrite.soLoadModule proxy_module modules/mod_proxy.soLoad
26、Module proxy_balancer_module modules/mod_proxy_balancer.soLoadModule proxy_ftp_module modules/mod_proxy_ftp.soLoadModule proxy_http_module modules/mod_proxy_http.soLoadModule proxy_connect_module modules/mod_proxy_connect.soLoadModule cache_module modules/mod_cache.soLoadModule suexec_module modules
27、/mod_suexec.soLoadModule disk_cache_module modules/mod_disk_cache.soLoadModule file_cache_module modules/mod_file_cache.soLoadModule mem_cache_module modules/mod_mem_cache.soLoadModule cgi_module modules/mod_cgi.soLoadModule version_module modules/mod_version.so# The following modules are not loaded
28、 by default:#LoadModule cern_meta_module modules/mod_cern_meta.so#LoadModule asis_module modules/mod_asis.so# Load config files from the config directory /etc/httpd/conf.d./将/etc/httpd/conf.d目录下所有以conf结尾的配置文件包含进来Include conf.d/*.conf# ExtendedStatus controls whether Apache will generate full status#
29、 information (ExtendedStatus On) or just basic information (ExtendedStatus# Off) when the server-status handler 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 (o
30、r #number) of the user/group to run httpd as.# . On SCO (ODT 3) use User nouser and Group nogroup.# . 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; # dont use Group #-1 on these systems!/设置运行Apache服务器的用户和组User apacheGroup apache# Section 2: Main server configuration# The directives in thi
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1