经典的apache 配置文件 

最近偶然发现火山互联的免费VPS又开放注册了.于是便注册用了一下。
比起去年的那个多了很多限制,如远程服务器的ssh、ftp、wget、curl 集体挂掉,连ping 也ping不通了……

默认还是apache + mysql + php + pureftpd 经典搭配.

本想移除apache,发现它的httpd.conf 配置还算比较经典,值得一般人采用.

张贴如下;

Listen 80
ServerName 127.0.0.1
ServerRoot "/usr/local/apache2"
DocumentRoot "/usr/local/apache2/htdocs"
ServerTokens Full
ServerSignature On
DefaultIcon /icons/unknown.gif
DefaultType text/plain
TypesConfig conf/mime.types
IndexOptions FancyIndexing VersionSort
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
ForceLanguagePriority Prefer Fallback

DirectoryIndex index.html index.htm index.php
AccessFileName .htaccess


Timeout 300
KeepAlive Off
UseCanonicalName Off
HostnameLookups Off


ExtendedStatus On
<Location /myserverstatus>
SetHandler server-status
Order Deny,Allow
Deny from all
Allow from all
</Location>

#LoadModule include_module modules/mod_include.so
#LoadModule deflate_module modules/mod_deflate.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule ident_module modules/mod_ident.so
#LoadModule ssl_module modules/mod_ssl.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule info_module modules/mod_info.so
#LoadModule cgid_module modules/mod_cgid.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule fastcgi_module modules/mod_fastcgi.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule headers_module modules/mod_headers.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule filter_module modules/mod_filter.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule bw_module modules/mod_bw.so
LoadModule php5_module modules/libphp5.so

<IfModule !mpm_winnt.c>
<IfModule !mpm_netware.c>
User vhost
Group vhost
</IfModule>
</IfModule>

<IfModule prefork.c>
StartServers 50
MinSpareServers 20
MaxSpareServers 50
ServerLimit 1000
MaxClients 800
MaxRequestsPerChild 10000
</IfModule>


<IfModule worker.c>
StartServers 5
ServerLimit 200
MaxClients 1000
MinSpareThreads 25
MaxSpareThreads 50
ThreadsPerChild 5
MaxRequestsPerChild 10000
</IfModule>

<IfModule mod_mime_magic.c>
MIMEMagicFile conf/magic
</IfModule>

<IfModule !mpm_netware_module>
PidFile logs/httpd.pid
</IfModule>

<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>
LockFile logs/accept.lock
</IfModule>
</IfModule>




Alias /icons/ "/usr/local/apache2/icons/"
AliasMatch ^/manual(?:/(?:de|en|es|fr|ja|ko|ru))?(/.*)?$ "/usr/local/apache2/manual$1"

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory "/usr/local/apache2/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>

<FilesMatch "\.(exe|com|vbs|vbe|bat|mdb|sql|wml)$">
Order allow,deny
Deny from all
</FilesMatch>



AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
LanguagePriority 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-CN zh-TW
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler type-map var
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^^

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

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
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

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 "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully


#LogLevel emerg
#LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Host}i\" \"%{Referer}i\" \"%{User-agent}i\"" common
#customlog "|/usr/local/apache2/bin/rotatelogs /var/log/httpd/access_%y_%m_%d_%H.log 3600 480" common


bandwidthmodule on

NameVirtualHost *

Include "/usr/local/apache2/conf/vhost.conf"

vhost.conf 内容;
#mysql.demo.com BEGIN
<VirtualHost *>
DocumentRoot /data/www/web/err/phpmyadmin
ServerName mysql.demo.com
php_admin_value open_basedir /data/www/web/err/phpmyadmin
php_admin_value upload_tmp_dir /data/www/web/err/phpmyadmin
</VirtualHost>
#mysql.demo.com END

#vhost.demo.com BEGIN
<VirtualHost *>
ErrorDocument 404 error.html
DirectoryIndex index.html
DocumentRoot /data/www/web/vhost
ServerName vhost.com
ServerAlias vhost.demo.com
php_admin_value open_basedir /data/www/web/vhost
php_admin_value upload_tmp_dir /data/www/web/vhost
</VirtualHost>
#vhost.demo.com END

评论