调整 .htaccess
默认的 .htaccess是包含有关于处理性能的部分的,但是是被注释掉的,可以选择合适的部分取消注释;
启用输出压缩
这一部分会打开 apache 的mod_deflate模块,将text、 css 和 javascript 先进行压缩再发送到浏览器。这样就会减少网络下载量,缩短等待时间,示例如下:
# Insert filter on all content SetOutputFilter DEFLATE # Insert filter on selected content types only AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript # Netscape 4.x has some problems... BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # Don't compress images SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary # enable resulting html compression php_flag zlib.output_compression on
ExpiresActive On
ExpiresDefault "access plus 1 year"
禁用 ETags
ETags(Entity tags)是服务器和浏览器的一个功能,它用来判断浏览器缓存里的元素是否和原来服务器上的一致。ETags比last-modified date更具有弹性,它用一个独一无二的字符串来标识一个元素的版本。 要关闭它很简单,做法如下:
FileETag none
日志太大,执行如下sql:
truncate dataflow_batch_export; truncate dataflow_batch_import; truncate log_customer; truncate log_quote; truncate log_summary; truncate log_summary_type; truncate log_url; truncate log_url_info; truncate log_visitor; truncate log_visitor_info; truncate log_visitor_online; truncate report_viewed_product_index; truncate report_compared_product_index; truncate report_event; set foreign_key_checks = 0; truncate index_process_event; truncate index_event; set foreign_key_checks = 1;