Apache服务器配置与使用工作笔记

uname -m -oecho "/usr/local/apache/lib" >> /etc/ld.so.confhwclock -w #将时间写入BIOSconfig.layout./configure --enable-layout=xxx.layoutapachectl -k startstatusproc httpdinetd#apachectlgracefulgraceful-stopconfigteststatusfullstatus#一个配置文件中启动多个apacheListen 443

DocumentRoot "xx"httpd -D SSL###################################httpd参数-f xx.conf-e warn-E xx.error-v-V  version -t  test config##################监控APACHE模块mod_statusSetHandler server-status

Order deny,allow

Deny from all

Allow from 192.168.1.2ExtendedStatus On###############################http://ip/server-status?autohttpd -M  #what modules have been loaded#############安装mod_log_access模块wget http://www.gjvc.com/software/Apache/modules/mod_log_access-1.03.tar.gztar zxf mod_log_access-1.03.tar.gzcd mod_log_access-1.03#mod MakefileAPACHE_PREFIX=/usr/local/apacheAPACHE_VERSION=2.2.21make && make install#####################################config add moduleLoadModule env_module libexec/mod_env.soClearModuleListAddModule mod_env.so#########################yum -y install mod_perlorwget http://perl.apache.org/dist/mod_perl-2.0-current.tar.gztar zxvf mod_perl-2.0-current.tar.gz && cd mod_perl-2.0.5perl Makefile.PL MP_APXS=/usr/local/apache/bin/apxsmake && make installhttpd -M | grep perl#########加速perl脚本Alias /perl/ /usr/local/apache/cgi-bin/SetHandler perl-script

PerlResponseHandler ModPerl::Registry

PerlOptions +ParseHeaders

Options +ExecCGI

Order allow,deny

Allow from all########################dirctoryfileslocationDirectoryIndexInclude conf/extra/httpd-autoindex.confwebmin gui config toolredhat-config-httpd  gui config toolservernameserveraliasdocumentrootifconfig eth0:0 122.222.222.222 netmask xxx upAddHandler cgi-script .cgi .pl###添加自己的CGI脚本处理程序AddHandler myfiletype .xyAction myfiletype /cgi-bin/program.cgiorSetHandler xx

Action xx /xx.cgi virtual ############################script GET /xx.cgiOptions +ExecCGIssipermanent  temp  seeother  gonerewriteengine onRewriteRule pattern substitution flagsRewriteCondpt:继续处理F:403  G:410  L:该URL不再被重写  NC:忽略大小写  P:交给代理处理RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteLogLevel 0  #禁止重写日志RewriteEngine OnRewriteRule ^/$ /FAQ/ [R]CheckSpelling on  无视URL[R,L]#proxyOrder Deny,Allow

Deny from all

Allow from www.xxx.comAllowCONNECT NoProxyProxyBlockProxyDomainProxyPass xx !ProxyPass /  http://www.xx.comProxyPassReverse  URL不会被重写CacheDefaultExpire  10    secondCacheDisable  /bin    不缓存CacheEnable mem/fd/disk /bin 用内存 文件 硬盘内存缓存模块LoadModule cache_module modules/mod_cache.soLoadModule mem_cache_module modules/mod_mem_cache.soCacheEnable mem /src/ww/

MCacheMaxObjectCount 100

MCacheMaxObjectSize 1

MCacheMaxStreamingBuffer 65535

MCacheMinObjectSize

MCacheRemovalAlgorithm GDSF

MCacheSize 10240LoadModule cache_module modules/mod_cache.soLoadModule disk_cache_module modules/mod_disk_cache.soCacheRoot /var

CacheEnable disk /

CacheDirLevels 5

CacheDirLength 3mod_file_cache  //无法缓存CGICacheFile /src/index.htmlnmapfile /src/index.html图片和动态内容一般转发到其他服务器Proxypass /img http://img.jonsk.comProxypassreverss /img http://img.jonsk.com#禁止代理服务器转发电子邮件Rewriteengine on

Rewriterule "^proxy:[a-z]*://[^/]*:25(/|$)" "-" [F,NC,L]Proxyblock ww.xx.com#mod_dbd链接DB需要安装apr-utils24小时进行分割CustomLog "|/usr/local/apache/bin/rotatelogs log/access_log 86400" commonCustomLog "|/usr/bin/rotatelogs log/access_log_%Y%m%d 86400 480" combinedErrorLog syslog:local7webalizerawstats#不记录日志SetEnvIfNoCase Referer "xxx"  no_img=1CustomLog logs/access_log combined env=!no_img${Referer}i        引用页面ab -n 1000 -c 10 http://www.baidu.comRequire valid-usermod_security 安全检查nikto 对网站进行检查chkrootkit 系统漏洞检查HostnameLookups off  DNS负载均衡htpasswd -c .htpasswd jonskhtpasswd -D .htpasswd jonshtpasswd .htpasswd jonskAuthType Basic AuthName "Rest Files"AuthUserFile /xxx/apasswdorder deny,allowAllow from all--enable-ssl

你可能感兴趣的:(Apache服务器配置与使用工作笔记)