[5419] | 1 | # |
---|
| 2 | # Configuracoes principais |
---|
| 3 | # |
---|
| 4 | Options -ExecCGI -MultiViews -Indexes |
---|
| 5 | DirectoryIndex index.php index.html index.htm |
---|
| 6 | DefaultLanguage pt-BR |
---|
| 7 | AddDefaultCharset ISO-8859-1 |
---|
| 8 | ServerSignature Off |
---|
| 9 | |
---|
| 10 | # |
---|
| 11 | # Configuracoes de "headers", cache e outras otimizacoes |
---|
| 12 | # |
---|
| 13 | # Disable caches and browsers from being able to validate files, |
---|
| 14 | # so they are forced to rely on your Cache-Control and Expires header. |
---|
| 15 | <ifModule mod_headers.c> |
---|
| 16 | Header unset ETag |
---|
| 17 | </ifModule> |
---|
| 18 | FileETag None |
---|
| 19 | |
---|
| 20 | #-> http://www.htaccesselite.com/htaccess/cache-control-http-headers-vt65.html |
---|
| 21 | # 300 5 M |
---|
| 22 | # 2700 45 M |
---|
| 23 | # 3600 1 H |
---|
| 24 | # 54000 15 H |
---|
| 25 | # 86400 1 D |
---|
| 26 | # 518400 6 D |
---|
| 27 | # 604800 1 W |
---|
| 28 | # 1814400 3 W |
---|
| 29 | # 2419200 1 M |
---|
| 30 | # 26611200 11 M |
---|
| 31 | # 29030400 1 Y (never expire) |
---|
| 32 | |
---|
| 33 | ## HEADER CACHING ## |
---|
| 34 | #-> http://www.htaccesselite.com/htaccess/caching-using-header-vt2.html |
---|
| 35 | #<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico)$"> |
---|
| 36 | # Header set Cache-Control "max-age=2592000" |
---|
| 37 | #</FilesMatch> |
---|
| 38 | #<FilesMatch "\.(js|css|pdf|swf)$"> |
---|
| 39 | # Header set Cache-Control "max-age=604800" |
---|
| 40 | #</FilesMatch> |
---|
| 41 | #<FilesMatch "\.(html|htm|txt)$"> |
---|
| 42 | # Header set Cache-Control "max-age=600" |
---|
| 43 | #</FilesMatch> |
---|
| 44 | #<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$"> |
---|
| 45 | # Header unset Cache-Control |
---|
| 46 | #</FilesMatch> |
---|
| 47 | |
---|
| 48 | ## ALTERNATE EXPIRES CACHING ## |
---|
| 49 | #-> htaccesselite.com/d/use-htaccess-to-speed-up-your-site-discussion-vt67.html |
---|
| 50 | #<ifModule mod_expires.c> |
---|
| 51 | # ExpiresActive On |
---|
| 52 | # ExpiresDefault "access plus 1 day" |
---|
| 53 | # Permite que os arquivos sejam "cacheados" tanto para http quanto para https |
---|
| 54 | # Header set Cache-Control "public" |
---|
| 55 | |
---|
| 56 | # ExpiresByType text/html "access plus 1 hour" |
---|
| 57 | # ExpiresByType text/plain "access plus 1 hour" |
---|
| 58 | # ExpiresByType text/css "access plus 1 hour" |
---|
| 59 | # ExpiresByType text/javascript "access plus 1 hour" |
---|
| 60 | # ExpiresByType application/x-javascript "access plus 1 hour" |
---|
| 61 | |
---|
| 62 | # ExpiresByType image/gif "access plus 1 week" |
---|
| 63 | # ExpiresByType image/jpg "access plus 1 week" |
---|
| 64 | # ExpiresByType image/png "access plus 1 week" |
---|
| 65 | |
---|
| 66 | #<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$"> |
---|
| 67 | #ExpiresActive Off |
---|
| 68 | #</FilesMatch> |
---|
| 69 | #</ifModule> |
---|
| 70 | |
---|
| 71 | # |
---|
| 72 | # Compactacao |
---|
| 73 | # |
---|
| 74 | <IfModule mod_deflate.c> |
---|
| 75 | SetOutputFilter DEFLATE |
---|
| 76 | |
---|
| 77 | AddOutputFilterByType DEFLATE application/x-httpd-php |
---|
| 78 | AddOutputFilterByType DEFLATE application/x-javascript |
---|
| 79 | AddOutputFilterByType DEFLATE application/x-httpd-fastphp |
---|
| 80 | AddOutputFilterByType DEFLATE application/xhtml+xml |
---|
| 81 | AddOutputFilterByType DEFLATE application/xml |
---|
| 82 | AddOutputFilterByType DEFLATE application/rss+xml |
---|
| 83 | AddOutputFilterByType DEFLATE application/atom_xml |
---|
| 84 | AddOutputFilterByType DEFLATE text/html |
---|
| 85 | AddOutputFilterByType DEFLATE text/plain |
---|
| 86 | AddOutputFilterByType DEFLATE text/xml |
---|
| 87 | AddOutputFilterByType DEFLATE text/css |
---|
| 88 | AddOutputFilterByType DEFLATE image/svg+xml |
---|
| 89 | |
---|
| 90 | # Use low settings for compression to make sure impact on server is low |
---|
| 91 | #DeflateMemLevel 2 |
---|
| 92 | #Highest 9 - Lowest 1 |
---|
| 93 | #DeflateCompressionLevel 9 |
---|
| 94 | |
---|
| 95 | #Skip browsers with known problems |
---|
| 96 | BrowserMatch ^Mozilla/4 gzip-only-text/html |
---|
| 97 | BrowserMatch ^Mozilla/4\.0[678] no-gzip |
---|
| 98 | BrowserMatch \bMSIE !no-gzip !gzip-only-text/html |
---|
| 99 | |
---|
| 100 | # properly handle requests coming from behind proxies |
---|
| 101 | <IfModule mod_headers.c> |
---|
| 102 | # Make sure proxies don't deliver the wrong content |
---|
| 103 | Header append Vary User-Agent env=!dont-vary |
---|
| 104 | </IfModule> |
---|
| 105 | |
---|
| 106 | SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary |
---|
| 107 | SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary |
---|
| 108 | SetEnvIfNoCase Request_URI \.(?:avi|mov|mp3|ogg|wmv|wma)$ no-gzip dont-vary |
---|
| 109 | SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary |
---|
| 110 | |
---|
| 111 | # Log file compression |
---|
| 112 | # DeflateFilterNote Input instream |
---|
| 113 | # DeflateFilterNote Output outstream |
---|
| 114 | # DeflateFilterNote Ratio ratio |
---|
| 115 | # LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate |
---|
| 116 | # CustomLog /var/log/apache2/deflate.log deflate |
---|
| 117 | |
---|
| 118 | </ifModule> |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | # |
---|
| 122 | # Reescritas e redirecionamentos |
---|
| 123 | # |
---|
| 124 | RewriteEngine On |
---|
| 125 | ## DENY REQUEST BASED ON REQUEST METHOD ## |
---|
| 126 | RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK|OPTIONS|HEAD)$ [NC] |
---|
| 127 | RewriteRule ^.*$ - [F] |
---|
[6528] | 128 | RewriteRule ^rest(.*)$ prototype/rest/$1 [QSA,L] |
---|
[5419] | 129 | |
---|
[6528] | 130 | |
---|
[5419] | 131 | # |
---|
| 132 | # Seguranca e restricoes de acesso |
---|
| 133 | # |
---|
| 134 | # Ao próprio htaccess e outros arquivos sensiveis (como senhas) |
---|
| 135 | <Files ~ "\.(htaccess|htpasswd|ini|srv|log|sh|svn)$"> |
---|
| 136 | Order Allow,Deny |
---|
| 137 | Deny from all |
---|
| 138 | Satisfy any |
---|
| 139 | </Files> |
---|
| 140 | |
---|
| 141 | #<Location /setup> |
---|
| 142 | # Options None |
---|
| 143 | # Order deny,allow |
---|
| 144 | # # Sua rede local |
---|
| 145 | # allow from 192.168.0.0/24 |
---|
| 146 | #</Location> |
---|
| 147 | |
---|
| 148 | # |
---|
[5313] | 149 | # Configuracoes do PHP para o Expresso |
---|
[6078] | 150 | # IMPORTANTE: estas configurações não serão carregadas |
---|
| 151 | # em ambientes que executam o PHP via FastCGI, FPM, |
---|
| 152 | # ou similares. Nestes casos, estas configurações |
---|
| 153 | # devem ser adicionadas diretamente ao php.ini. |
---|
[5419] | 154 | # |
---|
[5793] | 155 | <IfModule mod_php5.c> |
---|
[6078] | 156 | # Configuracoes de sessao |
---|
| 157 | php_flag session.auto_start Off |
---|
| 158 | php_flag session.use_cookies Off |
---|
[5793] | 159 | # Uses dir as a session handler |
---|
| 160 | php_value session.save_handler "files" |
---|
[6078] | 161 | php_value session.save_path "/dev/shm" |
---|
[5793] | 162 | # Use memcache as a session handler |
---|
| 163 | #php_value session.save_handler "memcache" |
---|
| 164 | #php_value session.save_path "tcp://localhost:11211?persistent=1&weight=1&timeout=1&retry_interval=15" |
---|
[6078] | 165 | php_value session.serialize_handler "php" |
---|
[5793] | 166 | php_value session.gc_probability 1 |
---|
| 167 | php_value session.gc_divisor 100 |
---|
[6616] | 168 | php_value session.gc_maxlifetime 14400 |
---|
[5793] | 169 | php_value session.cache_limiter nocache |
---|
| 170 | php_value session.cache_expire 180 |
---|
[6078] | 171 | php_flag session.use_trans_sid Off |
---|
[5313] | 172 | |
---|
[6078] | 173 | php_flag short_open_tag On |
---|
| 174 | php_flag zlib.output_compression Off |
---|
| 175 | php_flag output_buffering Off |
---|
| 176 | php_flag register_argc_argv On |
---|
| 177 | php_flag allow_url_include Off |
---|
| 178 | php_value variables_order "EGPCS" |
---|
| 179 | php_value default_charset "iso-8859-1" |
---|
| 180 | php_value default_mimetype "text/html" |
---|
| 181 | php_value date.timezone "America/Sao_Paulo" |
---|
| 182 | php_value url_rewriter.tags "a=href,area=href,frame=src,form=,fieldset=" |
---|
| 183 | #php_value url_rewriter.tags "a=href,area=href,frame=src,input=src,form=,fieldset=" |
---|
| 184 | |
---|
| 185 | php_value mbstring.func_overload "0" |
---|
| 186 | #php_value mbstring.func_overload "7" |
---|
| 187 | #php_flag mbstring.strict_detection On |
---|
[5313] | 188 | |
---|
[5793] | 189 | php_value max_execution_time 90 |
---|
| 190 | php_value max_input_time 120 |
---|
| 191 | php_value memory_limit 196M |
---|
| 192 | php_value post_max_size 50M |
---|
| 193 | php_value upload_max_filesize 40M |
---|
[5313] | 194 | |
---|
[6078] | 195 | # Para ambiente de desenvolvimento |
---|
[6098] | 196 | #php_flag log_errors On |
---|
| 197 | #php_value error_reporting "E_ALL & ~E_NOTICE" |
---|
| 198 | #php_flag ignore_repeated_errors On |
---|
| 199 | #php_flag report_memleaks On |
---|
| 200 | #php_flag html_errors On |
---|
[6078] | 201 | #php_value error_log /tmp/php.log |
---|
| 202 | |
---|
| 203 | # deprecate 5.3.0, removed 5.4.0 |
---|
| 204 | php_flag magic_quotes_gpc Off |
---|
| 205 | php_flag magic_quotes_runtime Off |
---|
| 206 | php_flag register_globals Off |
---|
| 207 | php_flag register_long_arrays Off |
---|
| 208 | php_flag allow_call_time_pass_reference On |
---|
| 209 | php_flag session.bug_compat_42 0 |
---|
| 210 | php_flag session.bug_compat_warn 0 |
---|
[5793] | 211 | </IfModule> |
---|