设为首页 收藏本站
查看: 1194|回复: 0

[经验分享] APACHE中 httpd.conf 的中文详解

[复制链接]

尚未签到

发表于 2017-1-6 09:10:56 | 显示全部楼层 |阅读模式
ServerRoot /Apache
#可以用绝对路径 e:webapache
#ServerRoot用于指定守护进程httpd的运行目录,httpd在启动之后将自动将进程的当前目录改变为这个目录,因此如果设置文件中指定的文件或目录是相对路径,那么真实路径就位于这个ServerRoot定义的路径之下。
PidFile logs/httpd.pid
#PidFile指定的文件将记录httpd守护进程的进程号,由于httpd能自动复制其自身,因此系统中有多个httpd进程,但只有一个进程为最初启动的进程,它为其他进程的父进程,对这个进程发送信号将影响所有的httpd进程。PidFILE定义的文件中就记录httpd父进程的进程号
Timeout 300
#Timeout定义客户程序和服务器连接的超时间隔,超过这个时间间隔(秒)后服务器将断开与客户机的连接.
KeepAlive On
#在HTTP 1.0中,一次连接只能作传输一次HTTP请求,而KeepAlive参数用于支持HTTP 1.1版本的一次连接、多次传输功能,这样就可以在一次连接中传递多个HTTP请求。虽然只有较新的浏览器才支持这个功能,但还是打开使用这个选项
MaxKeepAliveRequests 100
#MaxKeepAliveRequests为一次连接可以进行的HTTP请求的最大请求次数。将其值设为0将支持在一次连接内进行无限次的传输请求。事实上没有客户程序在一次连接中请求太多的页面,通常达不到这个上限就完成连接了。
KeepAliveTimeout 15
#KeepAliveTimeout测试一次连接中的多次请求传输之间的时间,如果服务器已经完成了一次请求,但一直没有接收到客户程序的下一次请求,在间隔超过了这个参数设置的值之后,服务器就断开连接。
<IfModule mpm_winnt.c>
ThreadsPerChild 250
MaxRequestsPerChild 0
</IfModule>
Listen 80
#端口,启动模块.下面许多模块只有在LIUNX下才有用
LoadModule access_module modules/mod_access.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_module modules/mod_auth.so
LoadModule dir_module modules/mod_dir.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
#LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule headers_module modules/mod_headers.so
#LoadModule imap_module modules/mod_imap.so
#LoadModule auth_anon_module modules/mod_auth_anon.so
#LoadModule auth_dbm_module modules/mod_auth_dbm.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
#LoadModule isapi_module modules/mod_isapi.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule status_module modules/mod_status.so
#LoadModule unique_id_module modules/mod_unique_id.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule ssl_module modules/mod_ssl.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule userdir_module modules/mod_userdir.so
LoadModule rewrite_module modules/mod_rewrite.so
#ExtendedStatus On
ServerAdmin abc@123.com
#服务器管理员邮箱,在出错,探针中显示
ServerName localhost.domain.com
UseCanonicalName Off
#是否允许对每个访问者的 DNS 域名的反向查询
DocumentRoot /Apache
#放网页的目录.这个很重要.
#你设置了,e:web是目录 而虚拟主机设置了e:webtwo
#虽然程序还是能运行,但是不在documentroot内的话,程序会有错误
<Directory />
Options FollowSymLinks MultiViews ExecCGI
AllowOverride None
</Directory>
<Directory /Apache/>
Options FollowSymLinks MultiViews ExecCGI
AllowOverride None
Order allow,deny
php_admin_value open_basedir /apache/
Allow from all
</Directory>
#以下是关于用户目录配置部分,即用户可以用http://www.xxxx.com/~username的方式来访问自已的网站!
#UserDir /apache/webroot/aaausersfreehost/*/public_html
#<Directory e:/虚拟主机/*/public_html>
# AllowOverride None
# Options MultiViews SymLinksIfOwnerMatch IncludesNoExec ExecCGI
#下面这条指令定义php只能对public_html此目录及其子目录下的文件进行操作.
# php_flag engine off #表示此目录下的PHP文件不被解释执行,限没有PHP权限。
# php_admin_value open_basedir ./
# Order allow,deny
# Allow from all
#</Directory>
#下面这条指令可以把虚拟目录freehost映射到实际路径/apache/webroot/users/下!
#AliasMatch ^/class/([0-9]).html$ /article.php?articleid=$1
#AliasMatch ^/class/([0-9] ).([0-9a-zA-Z] ).html$ /article.php?articleid=$1&amp;pagenum=$2
DirectoryIndex index.html index.htm index.php index.cgi bbs.pl index.pl admin.php login.htm login.html login.php
#默然主机头
AccessFileName .htaccess
<Files ~ ^.ht>
Order allow,deny
Deny from all
</Files>
TypesConfig conf/mime.types
DefaultType text/plain
<IfModule mod_mime_magic.c>
MIMEMagicFile conf/magic
</IfModule>
#以下是限制主机同时并发连接数
#<IfModule prefork.c>
#ServerLimit 2000
#StartServers 15
#MinSpareServers 15
#MaxSpareServers 20
#MaxClients 850 #最大客户端
#MaxRequestsPerChild 10000 #最大请求数
#</IfModule>
#以下是对单个文件进行访问控制
#<Files ~ 要屏蔽的文件的名称>
#Order allow,deny
#Allow from 允许IP
#Deny from all
#</Files>
HostnameLookups Off
#EnableMMAP off
#EnableSendfile off
ErrorLog logs/error.log
LogLevel warn
LogFormat 镲?? ?痋飁ferer}i 飐er-Agent}i combined
LogFormat 镲?? ??common
LogFormat 飁ferer}i -> ?referer
LogFormat 飐er-agent}i agent
CustomLog logs/access.log common
#CustomLog logs/referer.log referer
#CustomLog logs/agent.log agent
#CustomLog logs/access.log combined
ServerTokens Full
ServerSignature Off
#当客户请求的网页并不存在时,服务器将产生错误文档,缺省情况下由于打开了 ServerSignature选项,错误文档的最后一行将包含服务器的名字、Apache的版本等信息。
#Alias /class/ /apache/webroot/phpa #虚拟目录啦
# <Directory /apache/phpsafe> #对虚拟目录进行权限配置
# Options FollowSymLinks # MultiViews ExecCGI为有CGI执行权限
# php_admin_value safe_mode 1 #表示此目录下的PHP脚本只能有php_safe下权限
# php_admin_value open_basedir /apache/phpsafe/
# 此句是限制PHP的文件操作只能限于/apache/phpsafe及其子目录下,不能对此目录外的文进行操作
# php_flag engine off
#表示此目录下的PHP脚本不会被解释执行,此选项要求PHP必须以模块方式安装的!
# AllowOverride None
# Order allow,deny
# Allow from all #表示允许任何人从任何地方访问
# </Directory>
#ScriptAlias /cgi-bin/ E:/Apache2/cgi-bin/
#<Directory E:/Apache2/cgi-bin>
# AllowOverride None
# Options None
# Order allow,deny
# Allow from all
#</Directory>
IndexOptions FancyIndexing VersionSort
#AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
#AddIconByType (TXT,/icons/text.gif) text/*
#AddIconByType (IMG,/icons/image2.gif) image/*
#AddIconByType (SND,/icons/sound2.gif) audio/*
#AddIconByType (VID,/icons/movie.gif) video/*
#AddIcon /icons/binary.gif .bin .exe
#AddIcon /icons/binhex.gif .hqx
#AddIcon /icons/tar.gif .tar
#AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
#AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
#AddIcon /icons/a.gif .ps .ai .eps
#AddIcon /icons/layout.gif .html .shtml .htm .pdf
#AddIcon /icons/text.gif .txt
#AddIcon /icons/c.gif .c
#AddIcon /icons/p.gif .pl .py
#AddIcon /icons/f.gif .for
#AddIcon /icons/dvi.gif .dvi
#AddIcon /icons/uuencoded.gif .uu
#AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
#AddIcon /icons/tex.gif .tex
#AddIcon /icons/bomb.gif core
#AddIcon /icons/back.gif ..
#AddIcon /icons/hand.right.gif README
#AddIcon /icons/folder.gif ^^DIRECTORY^^
#AddIcon /icons/blank.gif ^^BLANKICON^^
#DefaultIcon /icons/unknown.gif
AddDescription GZIP compressed document .gz
AddDescription tar archive .tar
AddDescription GZIP compressed tar archive .tgz
ReadmeName README.html
HeaderName HEADER.html
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
AddEncoding x-compress Z
AddEncoding x-gzip gz tgz
AddLanguage ca .ca
AddLanguage cs .cz .cs
AddLanguage da .dk
AddLanguage de .de
AddLanguage el .el
AddLanguage en .en
AddLanguage eo .eo
AddLanguage es .es
AddLanguage et .et
AddLanguage fr .fr
AddLanguage he .he
AddLanguage hr .hr
AddLanguage it .it
AddLanguage ja .ja
AddLanguage ko .ko
AddLanguage ltz .ltz
AddLanguage nl .nl
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddLanguage pt .pt
AddLanguage pt-BR .pt-br
AddLanguage ru .ru
AddLanguage sv .sv
AddLanguage zh-CN .zh-cn
AddLanguage zh-TW .zh-tw
LanguagePriority zh-CN en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-TW
ForceLanguagePriority Prefer Fallback
#AddDefaultCharset ISO-8859-1
AddDefaultCharset GB2312
AddCharset ISO-8859-1 .iso8859-1 .latin1
AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen
AddCharset ISO-8859-3 .iso8859-3 .latin3
AddCharset ISO-8859-4 .iso8859-4 .latin4
AddCharset ISO-8859-5 .iso8859-5 .latin5 .cyr .iso-ru
AddCharset ISO-8859-6 .iso8859-6 .latin6 .arb
AddCharset ISO-8859-7 .iso8859-7 .latin7 .grk
AddCharset ISO-8859-8 .iso8859-8 .latin8 .heb
AddCharset ISO-8859-9 .iso8859-9 .latin9 .trk
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-CN .iso2022-cn .cis
AddCharset Big5 .Big5 .big5
# For russian, more than one charset is used (depends on client, mostly):
AddCharset WINDOWS-1251 .cp-1251 .win-1251
AddCharset CP866 .cp866
AddCharset KOI8-r .koi8-r .koi8-ru
AddCharset KOI8-ru .koi8-uk .ua
AddCharset ISO-10646-UCS-2 .ucs2
AddCharset ISO-10646-UCS-4 .ucs4
AddCharset UTF-8 .utf8
AddCharset GB2312 .gb2312 .gb
AddCharset utf-7 .utf7
AddCharset utf-8 .utf8
AddCharset big5 .big5 .b5
AddCharset EUC-TW .euc-tw
AddCharset EUC-JP .euc-jp
AddCharset EUC-KR .euc-kr
AddCharset shift_jis .sjis
#以CGI方式安装PHP
#ScriptAlias /__php_dir__/ /apache/cgiphp5/
#AddType application/x-httpd-php .php4 .php .htm .php3 .inc .fire
#Action application/x-httpd-php /__php_dir__/php.exe
#以apache的模块方式运行php
LoadModule php4_module /apache/php/sapi/php4apache.dll
PHPINIDir /apache/php/php.ini
AddType application/x-httpd-php .php .htm .php3
AddType application/x-httpd-php-source .phps
#支持fcgi
#LoadModule fastcgi_module modules/mod_fastcgi.dll
#AddHandler fastcgi-script .fcgi .fpl
AddType application/x-tar .tgz
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler cgi-script .cgi .pl
#AddHandler send-as-is asis
#AddHandler imap-file map
AddHandler type-map var
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
#ErrorDocument 500 The server made a boo boo.
#ErrorDocument 404 /apache/yyfzx/soft
#ErrorDocument 404 /apache/yyfzx/soft
#ErrorDocument 402 http://www.example.com/subscription_info.html
BrowserMatch Mozilla/2 nokeepalive
BrowserMatch MSIE 4.0b2; nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch RealPlayer 4.0 force-response-1.0
BrowserMatch Java/1.0 force-response-1.0
BrowserMatch JDK/1.0 force-response-1.0
BrowserMatch Microsoft Data Access Internet Publishing Provider redirect-carefully
BrowserMatch ^WebDrive redirect-carefully
BrowserMatch ^WebDAVFS/1.[012] redirect-carefully
BrowserMatch ^gnome-vfs redirect-carefully
#<Location /server-status>
# SetHandler server-status
# Order deny,allow
# Deny from all
# Allow from .51web.net
#</Location>
#<Location /server-info>
# SetHandler server-info
# Order deny,allow
# Deny from all
# Allow from .51web.net
#</Location>
<IfModule mod_ssl.c>
Include conf/ssl.conf
</IfModule>

#以下是关于虚拟机的配置
NameVirtualHost 218.87.169.209:80
<VirtualHost 218.87.169.209:80>
RewriteEngine On
RewriteRule ^/index.htm$ /index.php
RewriteRule ^/soft/([0-9] ).htm$ /download.php?soft=$1
RewriteRule ^/sort/([0-9-_] ).htm$ /list.php?list=$1
RewriteRule ^/sort/index.htm$ /type.php
RewriteRule ^/a-z/([0-9] ).htm$ /az.php?id=$1
DocumentRoot /apache/mayidown
ServerName mayidown.3322.org
</VirtualHost>
//以 #开头的就是解释用.启动的时候不加载的.我提供了一个虚拟主机给大家参考重写URL功能
(http://www.fanqiang.com)

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-324504-1-1.html 上篇帖子: org.apache.struts.taglib.html.BEAN 下篇帖子: tomcat链接apache mok_jk2配置3
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表