Apache 常用配置与说明
Apache 常用配置与说明? http://javadoc.org.cn/home.php?mod=space&uid=2&do=blog&id=20?
适应于个人相整点事情,小公司主机资源不是很富余,投资约1W含一年托管费,练手者就可以不看了,没什么必要,浪费时间,基本按这些说明下来搞定。
安装apache,svn,tomcat等参与我的其它相关播客<Directory "/var/soft/sites/wikso/ROOT/WEB-INF"> Order allow,deny</Directory>#禁止访问 /var/soft/sites/wikso/ROOT/WEB-INF目录ServerSignature OffServerTokens Prod#关闭apache响应版本等特征信息LoadModule authz_host_module modules/mod_authz_host.soLoadModule dav_module modules/mod_dav.soLoadModule dav_svn_module modules/mod_dav_svn.soLoadModule authz_svn_module modules/mod_authz_svn.soLoadModule authz_owner_module modules/mod_authz_owner.soLoadModule authn_file_module modules/mod_authn_file.soLoadModule auth_basic_module modules/mod_auth_basic.soLoadModule authz_user_module modules/mod_authz_user.soLoadModule jk_module modules/mod_jk.so#加载 svn tomcat连接模块JkWorkersFile "/var/soft/bin/apache/conf/workers.properties"JkLogFile "/var/soft/bin/apache/logs/mod_jk.log"JkLogLevel emergJkShmFile /var/soft/bin/apache/logs/mod_jk.shm#Tomcat 连接模块配置信息,日志等LoadModule setenvif_module modules/mod_setenvif.soLoadModule log_config_module modules/mod_log_config.soSetEnvIf Request_URI /a/* aimagesSetEnvIf Request_URI "\.jpg$" aimagesSetEnvIf Request_URI "\.png$" aimagesSetEnvIf Request_URI "\.gif$" aimagesSetEnvIf Request_URI /dwr/* aimagesLogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined#CustomLog "|/usr/local/sbin/cronolog /var/soft/bin/apache/logs/access_log.%Y%m%d" combined env=!aimages#设置日志记录条件AddType application/x-httpd-php .php .phtmlAddType applicatoin/x-httpd-php-source .phps#加载PHP模板LoadModule rewrite_module modules/mod_rewrite.so#加载重定向模板,设置防盗链NameVirtualHost *:80<VirtualHost *:80>ServerAdmin web@javadoc.org.cnDocumentRoot /var/soft/sites/javadoc/ ServerName www.javadoc.org.cn ServerAlias javadoc.org.cnRewriteEngine onRewriteCond %{HTTP_HOST} !^javadoc.org.cn [NC]RewriteRule ^(.*)$ http://javadoc.org.cn$1 [R] ErrorLog "logs/javadoc-error_log"LogFormat "%h %{Host}i %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combinedhost CustomLog "|/usr/local/sbin/cronolog /var/soft/bin/apache/logs/javadoc/access_log.%Y%m%d" combinedhost env=!aimages</VirtualHost>#防盗链只要设在第一个VirtualHost 就可以,其它的会以主机名对应,第一个会对应所以的IP,当其它的主机没有匹配上时#按天记录日志 <VirtualHost *:80>ServerName svn.javadoc.org.cn<Location /> DAV svn SVNParentPath /var/soft/sites/svn/ AuthType Basic AuthName "Subversion repository" AuthUserFile /var/soft/bin/apache/bin/userfile AuthzSVNAccessFile /var/soft/bin/apache/conf/authz Require valid-user</Location></VirtualHost>#SVN设置<VirtualHost *:80>DocumentRoot /var/soft/sites/wikso/ROOT/ServerName www.wikso.comServerAlias wikso.com *.wikso.comJkUnMount /a/* worker1JkMount /* worker1 ErrorLog "logs/wikso-error_log" CustomLog "|/usr/local/sbin/cronolog /var/soft/bin/apache/logs/wikso/access_log.%Y%m%d" combined env=!aimages</VirtualHost>#tomcat整合+日志其它部分部分 LogFormat %{Host}i 指出请求的主机名,可记录盗链的主机域名CustomLog cronolog 实现按天存workers.properties文件内容workers.tomcat_home=/var/soft/tomcat6workers.java_home=/usr/java/jdk1.6.0_20worker.list=worker1worker.worker1.port=8009worker.worker1.host=localhostworker.worker1.type=ajp13worker.worker1.connection_pool_timeout=600worker.worker1.socket_keepalive=1worker.worker1.lbfactor=1