The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

File caching permanently for server - httpd.conf

Discussion in 'General Discussion' started by postcd, Feb 27, 2011.

  1. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    621
    Likes Received:
    6
    Trophy Points:
    18
    Hello,

    i would like to set caching of files like images and other media.

    # 480 weeks
    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Cache-Control "max-age=290304000, public"
    </FilesMatch>

    this should be added into httpd.conf, but i would like to add it into WHM so changes remain. How can i apply this for particular user account and or entire server please?

    Thank You
     
  2. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    The following section of our EasyApache documentation explains how to add custom entries within <VirtualHost></VirtualHost> containers and have them preserved when cPanel and/or Apache is updated:

    Changes Contained within a VirtualHost Directive

    Also, this page provides an overview of how cPanel and Apache interact, with links to more documentation explaining how to customize Apache and PHP:

    The Apache Web Server and cPanel & WHM
     
  3. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    621
    Likes Received:
    6
    Trophy Points:
    18
    Is there any guide how to add my code into WHM? Above manuals too difficult to study.
     
  4. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    No, the modifications must be done via the shell by editing the files mentioned in the documentation to which I referred you.

    Are there any particular sections of our documentation that you find difficult to understand? We welcome any suggestions that we can use to improve our documentation and make it both more informative and easier to read.
     
  5. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    621
    Likes Received:
    6
    Trophy Points:
    18
    Your manual is good, but im not a native speaker so its hard for me to get thru all info. I have seen this guide (How to Enable mod_deflate GZIP Compression on CPanel Web Hosts » My Digital Life), and author says:

    I would like to try it if it will decrease my Server Load. Are the mentioned rules good in your eyes? Is it proper way to edit PHP config on cPanel server?
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    If you want this enabled globally for the server, you can indeed try putting it into the Post VirtualHost Include section as indicated. Otherwise, you might try the Pre VirtualHost Include section in WHM > Apache Configuration > Include Editor area.
     
  7. ! am bond

    ! am bond Guest

    If you're trying to cache files generated through php so that you can save some php/mysql resources, look at php buffer functions, they can be helpful
     
Loading...

Share This Page