Linux中HTTP服务配置.docx

上传人:b****4 文档编号:12311362 上传时间:2023-04-18 格式:DOCX 页数:39 大小:30.79KB
下载 相关 举报
Linux中HTTP服务配置.docx_第1页
第1页 / 共39页
Linux中HTTP服务配置.docx_第2页
第2页 / 共39页
Linux中HTTP服务配置.docx_第3页
第3页 / 共39页
Linux中HTTP服务配置.docx_第4页
第4页 / 共39页
Linux中HTTP服务配置.docx_第5页
第5页 / 共39页
点击查看更多>>
下载资源
资源描述

Linux中HTTP服务配置.docx

《Linux中HTTP服务配置.docx》由会员分享,可在线阅读,更多相关《Linux中HTTP服务配置.docx(39页珍藏版)》请在冰豆网上搜索。

Linux中HTTP服务配置.docx

Linux中HTTP服务配置

HTTP服务配置

一、下载版本

1、解压

#cd/opt/software

#tarzxvfhttp2.2.tar.gz

2、配置

#cd/opt/software/http2.2

#./configure--prefix=/usr/local/http2.2

3、编译

#make

4、安装

#makeinstall

5、配置文件

#vi/usr/local/http2.2/conf/httpd.conf

6、启动

#/usr/local/http2.2/bin/apachectl-kstart

二、Linux自带http服务配置文件

#

#ThisisthemainApacheserverconfigurationfile.Itcontainsthe

#configurationdirectivesthatgivetheserveritsinstructions.

#See

http:

//httpd.apache.org/docs/2.2/>fordetailedinformation.

#Inparticular,see

#

http:

//httpd.apache.org/docs/2.2/mod/directives.html>

#foradiscussionofeachconfigurationdirective.

#

#DoNOTsimplyreadtheinstructionsinherewithoutunderstanding

#whattheydo.They'rehereonlyashintsorreminders.Ifyouareunsure

#consulttheonlinedocs.Youhavebeenwarned.

#

#Theconfigurationdirectivesaregroupedintothreebasicsections:

#1.DirectivesthatcontroltheoperationoftheApacheserverprocessasa

#whole(the'globalenvironment').

#2.Directivesthatdefinetheparametersofthe'main'or'default'server,

#whichrespondstorequeststhataren'thandledbyavirtualhost.

#Thesedirectivesalsoprovidedefaultvaluesforthesettings

#ofallvirtualhosts.

#3.Settingsforvirtualhosts,whichallowWebrequeststobesentto

#differentIPaddressesorhostnamesandhavethemhandledbythe

#sameApacheserverprocess.

#

#Configurationandlogfilenames:

Ifthefilenamesyouspecifyformany

#oftheserver'scontrolfilesbeginwith"/"(or"drive:

/"forWin32),the

#serverwillusethatexplicitpath.Ifthefilenamesdo*not*begin

#with"/",thevalueofServerRootisprepended--so"logs/foo.log"

#withServerRootsetto"/etc/httpd"willbeinterpretedbythe

#serveras"/etc/httpd/logs/foo.log".

#

###Section1:

GlobalEnvironment

#ThedirectivesinthissectionaffecttheoveralloperationofApache,

#suchasthenumberofconcurrentrequestsitcanhandleorwhereit

#canfinditsconfigurationfiles.

#

#Don'tgiveawaytoomuchinformationaboutallthesubcomponents

#wearerunning.Commentoutthislineifyoudon'tmindremotesites

#findingoutwhatmajoroptionalmodulesyouarerunning

ServerTokensOS//当服务器响应主机头(header)信息时显示Apache的版本和操作系统名称

#

#ServerRoot:

Thetopofthedirectorytreeunderwhichtheserver's

#configuration,error,andlogfilesarekept.

#

#NOTE!

IfyouintendtoplacethisonanNFS(orotherwisenetwork)

#mountedfilesystemthenpleasereadtheLockFiledocumentation

#(availableat

http:

//httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);

#youwillsaveyourselfalotoftrouble.

#

#DoNOTaddaslashattheendofthedirectorypath.

ServerRoot"/etc/httpd"//设置服务器的根目录

#

#PidFile:

Thefileinwhichtheservershouldrecorditsprocess

#identificationnumberwhenitstarts.

#

PidFilerun/httpd.pid//设置运行Apache时使用的PidFile的路径

#

#Timeout:

Thenumberofsecondsbeforereceivesandsendstimeout.

#

Timeout120//若120秒后没有收到或送出任何数据就切断该连接

#

#KeepAlive:

Whetherornottoallowpersistentconnections(morethan

#onerequestperconnection).Setto"Off"todeactivate.

#

KeepAliveOff//不使用保持连接的功能,即客户一次请求连接只能响应一个文件

/建议用户将此参数的值设置为On,即允许使用保持连接的功能

#

#MaxKeepAliveRequests:

Themaximumnumberofrequeststoallow

#duringapersistentconnection.Setto0toallowanunlimitedamount.

#Werecommendyouleavethisnumberhigh,formaximumperformance.

#

MaxKeepAliveRequests100//在使用保持连接功能时,设置客户一次请求连接能响应文件的最大上限

#

#KeepAliveTimeout:

Numberofsecondstowaitforthenextrequestfromthe

#sameclientonthesameconnection.

#

KeepAliveTimeout15//在使用保持连接功能时,两个相邻的连接的时间间隔超过15秒,就切断连接

###Server-PoolSizeRegulation(MPMspecific)

##

#preforkMPM

#StartServers:

numberofserverprocessestostart

#MinSpareServers:

minimumnumberofserverprocesseswhicharekeptspare

#MaxSpareServers:

maximumnumberofserverprocesseswhicharekeptspare

#ServerLimit:

maximumvalueforMaxClientsforthelifetimeoftheserver

#MaxClients:

maximumnumberofserverprocessesallowedtostart

#MaxRequestsPerChild:

maximumnumberofrequestsaserverprocessserves

//设置使用Prefork MPM运行方式的参数,此运行方式是Red hat默认的方式

StartServers8//设置服务器启动时运行的进程数

MinSpareServers5//Apache在运行时会根据负载的轻重自动调整空闲子进程的数目

//若存在低于5个空闲子进程,就创建一个新的子进程准备为客户提供服务

MaxSpareServers20//若存在高于20个空闲子进程,就创建逐一删除子进程来提高系统性能

ServerLimit256

MaxClients256//限制同一时间的连接数不能超过256

MaxRequestsPerChild4000//限制每个子进程在结束处理请求之前能处理的连接请求为4000

#workerMPM

#StartServers:

initialnumberofserverprocessestostart

#MaxClients:

maximumnumberofsimultaneousclientconnections

#MinSpareThreads:

minimumnumberofworkerthreadswhicharekeptspare

#MaxSpareThreads:

maximumnumberofworkerthreadswhicharekeptspare

#ThreadsPerChild:

constantnumberofworkerthreadsineachserverprocess

#MaxRequestsPerChild:

maximumnumberofrequestsaserverprocessserves

//设置使用perchild MPM运行方式的参数

StartServers2

MaxClients150

MinSpareThreads25

MaxSpareThreads75

ThreadsPerChild25

MaxRequestsPerChild0

#

#Listen:

AllowsyoutobindApachetospecificIPaddressesand/or

#ports,inadditiontothedefault.Seealsothe

#directive.

#ChangethistoListenonspecificIPaddressesasshownbelowto

#preventApachefromglommingontoallboundIPaddresses(0.0.0.0)

#

#Listen12.34.56.78:

80

Listen90//设置服务器的监听端口

#

#DynamicSharedObject(DSO)Support//动态加载模块(DSO)

#

#TobeabletousethefunctionalityofamodulewhichwasbuiltasaDSOyou

#havetoplacecorresponding`LoadModule'linesatthislocationsothe

#directivescontainedinitareactuallyavailable_before_theyareused.

#Staticallycompiledmodules(thoselistedby`httpd-l')donotneed

#tobeloadedhere.

#Example:

#LoadModulefoo_modulemodules/mod_foo.so

#

LoadModuleauth_basic_modulemodules/mod_auth_basic.so

LoadModuleauth_digest_modulemodules/mod_auth_digest.so

LoadModuleauthn_file_modulemodules/mod_authn_file.so

LoadModuleauthn_alias_modulemodules/mod_authn_alias.so

LoadModuleauthn_anon_modulemodules/mod_authn_anon.so

LoadModuleauthn_dbm_modulemodules/mod_authn_dbm.so

LoadModuleauthn_default_modulemodules/mod_authn_default.so

LoadModuleauthz_host_modulemodules/mod_authz_host.so

LoadModuleauthz_user_modulemodules/mod_authz_user.so

LoadModuleauthz_owner_modulemodules/mod_authz_owner.so

LoadModuleauthz_groupfile_modulemodules/mod_authz_groupfile.so

LoadModuleauthz_dbm_modulemodules/mod_authz_dbm.so

LoadModuleauthz_default_modulemodules/mod_authz_default.so

LoadModuleldap_modulemodules/mod_ldap.so

LoadModuleauthnz_ldap_modulemodules/mod_authnz_ldap.so

LoadModuleinclude_modulemodules/mod_include.so

LoadModulelog_config_modulemodules/mod_log_config.so

LoadModulelogio_modulemodules/mod_logio.so

LoadModuleenv_modulemodules/mod_env.so

LoadModuleext_filter_modulemodules/mod_ext_filter.so

LoadModulemime_magic_modulemodules/mod_mime_magic.so

LoadModuleexpires_modulemodules/mod_expires.so

LoadModuledeflate_modulemodules/mod_deflate.so

LoadModuleheaders_modulemodules/mod_headers.so

LoadModuleusertrack_modulemodules/mod_usertrack.so

LoadModulesetenvif_modulemodules/mod_setenvif.so

LoadModulemime_modulemodules/mod_mime.so

LoadModuledav_modulemodules/mod_dav.so

LoadModulestatus_modulemodules/mod_status.so

LoadModuleautoindex_modulemodules/mod_autoindex.so

LoadModuleinfo_modulemodules/mod_info.so

LoadModuledav_fs_modulemodules/mod_dav_fs.so

LoadModulevhost_alias_modulemodules/mod_vhost_alias.so

LoadModulenegotiation_modulemodules/mod_negotiation.so

LoadModuledir_modulemodules/mod_dir.so

LoadModuleactions_modulemodules/mod_actions.so

LoadModulespeling_modulemodules/mod_speling.so

LoadModuleuserdir_modulemodules/mod_userdir.so

LoadModulealias_modulemodules/mod_alias.so

LoadModulerewrite_modulemodules/mod_rewrite.so

LoadModuleproxy_modulemodules/mod_proxy.so

LoadModuleproxy_balancer_modulemodules/mod_proxy_balancer.so

LoadModuleproxy_ftp_modulemodules/mod_proxy_ftp.so

LoadModuleproxy_http_modulemodules/mod_proxy_http.so

LoadModuleproxy_connect_modulemodules/mod_proxy_connect.so

LoadModulecache_modulemodules/mod_cache.so

LoadModulesuexec_modulemodules/mod_suexec.so

LoadModuledisk_cache_modulemodules/mod_disk_cache.so

LoadModulefile_cache_modulemodules/mod_file_cache.so

LoadModulemem_cache_modulemodules/mod_mem_cache.so

LoadModulecgi_modulemodules/mod_cgi.so

LoadModuleversion_modulemodules/mod_version.so

#

#Thefollowingmodulesarenotloadedbydefault:

#LoadModulecern_meta_modulemodules/mod_cern_meta.so

#LoadModuleasis_modulemodules/mod_asis.so

#

#Loadconfigfilesfromtheconfigdirectory"/etc/httpd/conf.d".

//将/etc/httpd/conf.d目录下所有以conf结尾的配置文件包含进来

Includeconf.d/*.conf

#

#ExtendedStatuscontrolswhetherApachewillgenerate"full"status

#information(ExtendedStatusOn)orjustbasicinformation(ExtendedStatus

#Off)whenthe"server-status"handleriscalled.ThedefaultisOff.

#

#ExtendedStatusOn

#

#Ifyouwishhttpdtorunasadifferentuserorgroup,youmustrun

#httpdasrootinitiallyanditwillswitch.

#

#User/Group:

Thename(or#number)oftheuser/grouptorunhttpdas.

#.OnSCO(ODT3)use"Usernouser"and"Groupnogroup".

#.OnHPUXyoumaynotbeabletousesharedmemoryasnobody,andthe

#suggestedworkaroundistocreateauserwwwandusethatuser.

#NOTEthatsomekernelsrefusetosetgid(Group)orsemctl(IPC_SET)

#whenthevalueof(unsigned)Groupisabove60000;

#don'tuseGroup#-1onthesesystems!

//设置运行Apache服务器的用户和组

Userapache

Groupapache

###Section2:

'Main'serverconfiguration

#Thedirectivesinthi

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 商务科技

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1