IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    magento性能优化

    阿川发表于 2016-01-27 16:16:37
    love 0

    调整 .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

    启用Expires Headers
    注意:这一配置在Litespeed servers无效
    浏览器使用 Expires Headers来确定页面组件可以被缓存多长时间。静态的部件,如图像,可以设置为永不过期,但还是建议设置一个Expires Headers。要打开这个特性,可以取消注释对应的行并添加"ExpiresActive 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;



沪ICP备19023445号-2号
友情链接