精彩推荐

Magento: Optimizing Magento

1488人阅读  0人回复   查看全部 | 阅读模式 | 复制链接   

2

主题

2

帖子

8

积分

新手上路

Rank: 1

积分
8
发表于 2015-4-23 23:11:51
分享到:
Changes to .htaccess
Enable Output Compression

In your .htaccess file for Magento you will find a section of text starting with the line, <IfModule mod_deflate.c> and ending at </IfModule>

Enable Expires Headers

First-time visitors to your page have to make several HTTP requests. By using the "Expires" header you make the components  of the requests cacheable. This avoids unnecessary HTTP requests on subsequent page views.

You want to find the area of the .htaccess file that starts with <IfModule mod_expires.c> and ends with the first </IfModule> you see after it, and make it look like this:


  1. <IfModule mod_expires.c>

  2. ############################################
  3. ## Add default Expires header
  4. ## http://developer.yahoo.com/performance/rules.html#expires

  5.      ExpiresActive On
  6.      ExpiresDefault "access plus 1 year"

  7. </IfModule>

  8. Color coding of code is added for readability and is not actually part of the code.
  9. Magento Administration Tweaks
  10. Merge CSS and JS

  11. This particular tweak will reduce the number of HTTP requests on your eCommerce site. If you are using a Magento version prior to 1.4.x, the free extension Fooman_Speedster can be used, if you are running a later version of Magento follow this:

  12.     Login to your administration area and go to - System > Configuration > Developer
  13.     Under "JavaScript Settings", change "Merge JavaScript Files" to yes.
  14.     Under "CSS Settings", change "Merge CSS Files" to yes.
  15.     Finally you will want to clear your Magento cache.

  16. Enabling Flat Catalog

  17. The model Magento uses to store customer and product data results in longer than average SQL queries and more reads. Enabling the Flat Catalog option for Categories and Products will merge product data into one table, therefore improving performance.

  18.     Login to your administration area and go to - System > Configuration > Catalog
  19.     Under "Frontend", change "Use Flat Catalog Category" to yes.
  20.     Under "Frontend", change "Use Flat Catalog Product" to yes - this is optional.
  21.     Finally you will want to clear your Magento cache.

  22. Database Maintenance Tips

  23. One of the main issues with Magento sites running slowly, is a database that has become large and difficult to use for sending/retrieving data from.

  24. Here are a few tips for reducing the size of your Magento database.

  25.     NOTE: Please be sure to backup your database before performing any of the following changes.

  26. Database Logs

  27. There are several tables used by Magento for logging. While logging is very important regarding knowing what has and is going on with your store, the logs can become large very quickly, so regularly maintenance can be of great assistance.

  28. Here are the tables for logging:

  29. log_customer
  30. log_visitor
  31. log_visitor_info
  32. log_url
  33. log_url_info
  34. log_quote
  35. report_viewed_product_index
  36. report_compared_product_index
  37. report_event
  38. catalog_compare_item
  39. Database Log Cleaning using Magento Administration

  40.     In Magento Administration go to System > Configuration
  41.     In the left menu under Advanced click on System
  42.     Under "Log Cleaning", change "Enable Log Cleaning" to YES and configure the Save Log for 14 days.
  43.     Click "Save Config"

  44. log.php Utility

  45. Magento provides a shell utility that can be configured using Cron or run manually to clean the database logs.

  46. Manually

  47. Log into your account via SSH and cd to the Magento root directory thentype:

  48. php -f shell/log.php clean

  49. You can use the -days switch to specify how many days back to save

  50. Cron

  51.     You will want to login to cPanel
  52.     Click on Cron Jobs

  53. This is an example only:

  54. php -f /home/yourcpanelusername/public_html/path/to/magento/shell/log.php

  55. Note: The above line is on one line and may have been word-wrapped by the web browser. You may want to copy and paste to make sure everything is on one line.
  56. Database Cleaning via phpMyAdmin

  57. Using phpMyAdmin offers more flexibility and efficiency when working with databases.

  58.     Login to cPanel and click on phpMyAdmin
  59.     Click on the database associated with your Magento installation
  60.     Now select these tables:

  61. log_customer
  62. log_quote
  63. log_summary
  64. log_summary_type
  65. log_url
  66. log_url_info
  67. log_visitor
  68. log_visitor_info
  69. log_visitor_online

  70.     Below the tables listed, click on the drop-down box "With Selected:" and select Empty
  71.     You will get a confirmation screen, click Yes.

  72. You will want to perform this database log cleaning on a regular basis. Utilizing the cron job option will ensure it is done without the need to perform any manual tasks. You will want to be sure you have properly setup this cron.
复制代码

回复

使用道具 举报

快速回复 返回顶部 返回列表