Abaixo segue o conteúdo do meu arquivo httpd-vhosts.conf
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@exemplo.com
DocumentRoot c:/Apache24/htdocs/exemplo
ServerName www.exemplo.com
ServerAlias exemplo.com *.exemplo.com
DirectoryIndex index.html
ErrorLog logs/exemplo.com-error.log
CustomLog logs/exemplo.com-access.log common
<Directory "c:/Apache24/htdocs/exemplo">
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
</Directory>
#habilita o deflate
SetOutputFilter DEFLATE
#define o nível de compressão
DeflateCompressionLevel 9
#corrige imcompatibilidade com browsers que não suportam o mod_deflate
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Exclui as seguintes extensões: gif,jpg,png,mp3,mp4,avi,rar,zip,pdf,swf
# essas extensões já apresentam conteúdo compactado.
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|mp3|mp4|avi|rar|zip|pdf|swf)$ no-gzip dont-vary
#Criando deflate_log
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog logs/deflate_log deflate
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 day"
ExpiresByType text/cache-manifest "access plus 0 seconds"
# Html
ExpiresByType text/html "access plus 86400 seconds"
# Dados
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"
# Feed
ExpiresByType application/rss+xml "access plus 1 hour"
ExpiresByType application/atom+xml "access plus 1 hour"
# Favicon
ExpiresByType image/x-icon "access plus 1 week"
# Midia: images, video, audio
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
# Arquivos htc
ExpiresByType text/x-component "access plus 1 month"
# fonts
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
# css / javascript
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
# Desativar cache para o arquivo index.php
<FilesMatch "index\.php$">
ExpiresActive Off
</FilesMatch>
</IfModule>
<IfModule mod_headers.c>
# Cache-Control de 4 horas (14400 segundos) de tipo público
<FilesMatch "\.(jpg|jpeg|png|gif|ico|css|js)$">
Header set Cache-Control "max-age=14400, public"
</FilesMatch>
# Desativar cache para o arquivo index.php
# O cabeçalho "pragma" é para compatibilidade com o IE
<FilesMatch "index\.php$">
Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate"
Header set Pragma "no-cache"
</FilesMatch>
Header unset Etag
FileETag None
Header unset Last-Modified
</IfModule>
</VirtualHost>
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@exemplo.com
DocumentRoot c:/Apache24/htdocs/outroexemplo
ServerName www.outroexemplo.com
ServerAlias outroexemplo.com *.outroexemplo.com
DirectoryIndex index.html
ErrorLog logs/outroexemplo.com-error.log
CustomLog logs/outroexemplo.com-access.log common
<Directory "c:/Apache24/htdocs/outroexemplo">
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
Nenhum comentário:
Postar um comentário