I would like to enable cache as plugin told me to do.

I would like to enable cache as plugin told me to do.
I paste the generated code in my nginx con file and website unavailable. Do you see why ?

location ~* \.(txt|xml|js|css)$ {
    expires 8d;
}

location ~* \.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$ {
    expires 8d;
}

location ~* \.(jpg|jpeg|png|gif|swf|webp)$ {
    expires 8d;
}

and the nginx file where I suppress this code to make the available.

Do you see why it stop all website working with Hummingbird code ?

I also try via htaccess, the same situation, the site root page is a white apache error !

Thank you

  • Tyler Postle

    Hey Laurent_C,

    I find it odd you would get an apache error if you are using nginx. I'm guessing you must be using nginx if you have the config file for it? How is your server setup exactly?

    If you could send in your FTP then I can pass it onto one of our staff that is more versed in system administration so they can investigate further :slight_smile:

    You can send that privately through our contact form: https://premium.wpmudev.org/contact/

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me.

    Send in:

    Subject: "Attn: Tyler Postle"
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant urls

    **If you keep support access active then no need to send in wp-admin

    Look forward to hearing back!

    Cheers,
    Tyler

  • Laurent_C

    Hello Tyler,
    I still got the problem and send you answer via mail, but I see nothing since two days. Is there a problem with the Hummingbird config in my server ?
    I note the WP DEFENDER just give me "BAD GETAWAY Nginx time response off" !
    NGINX problem in the 2 case, and when I modify with nginx config give by Hummingbird all my website are broken,
    What must I do ?
    I send you answer by mail since 48 hours, time is gold for me actually
    Thank you.

  • Tyler Postle

    Just pasting the developers response here in-case anyone else has the same issue :slight_smile:

    ------------------

    It seems some sort of incompatibility between the Hummingbird code and your Apache configuration. Your Apache .htaccess file does not allow ExpiresDefault and ExpiresActive directives. You need to use this code instead:

    <IfModule mod_headers.c>
    
      <FilesMatch "\.(txt|xml|js|css)$">
       Header set Cache-Control "max-age=691200"
      </FilesMatch>
    
      <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$">
       Header set Cache-Control "max-age=691200"
      </FilesMatch>
    
      <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
       Header set Cache-Control "max-age=691200"
      </FilesMatch>
     </IfModule>

    There's also a way to change the code snippet in Humminbird. Use this PHP code (in your Main Site Theme or another plugin that you use for hacks):

    add_filter( 'wphb_code_snippet', 'wphb_hack_code_snippet', 10, 3 );
    function wphb_hack_code_snippet( $snippet, $server_type, $module ) {
    	if ( 'caching' === $module->get_slug() && 'apache' === $server_type ) {
    		$snippet = '
    <IfModule mod_headers.c>
    
      <FilesMatch "\.(txt|xml|js|css)$">
       Header set Cache-Control "max-age=%%ASSETS_HEAD%%"
      </FilesMatch>
    
      <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$">
       Header set Cache-Control "max-age=%%MEDIA_HEAD%%"
      </FilesMatch>
    
      <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
       Header set Cache-Control "max-age=%%IMAGES_HEAD%%"
      </FilesMatch>
     </IfModule>';
    	}
    
    	return $snippet;
    }

    This way, you'll be able to change the expiration days and also to enable/disable caching from Hummingbird screen without touching .htaccess yourself.

    ------------------

    If you do have further issues with that just let us know.

    Cheers,
    Tyler

  • Laurent_C

    Morning Tyler,

    I create function in function php and it doesn't work
    I Use Direct configuration in .htaccess then buttons are green

    I open HummingBird and got this message : The performance scan didn't return any results. This probably means you're on a local website (which we can't scan) or something went wrong trying to access WPMU DEV. Try again and if this error continues to appear please open a ticket with our support heroes

    Why is this so complex to make it works ?
    Im on an OVH server witch is a big european station and also use a predefine server with Linux and Plesk. Im not under Win 95 ... so when you said my server is out and have special configuration, its strange to hear that it can't work

    Thank you

    Thank you

  • Tyler Postle

    Hey Laurent,

    Sorry such a delay here!

    It looks like you are on a old version of Hummingbird, can you make sure you are updated to 1.1.2 if you aren't already and try the scan again? If you get the same error then could you grant support access so we can have another look? I'll let the developer know that this still isn't working for you too.

    You can grant support access via WPMU DEV > Support > Grant Support Access.

    By the way, I tried the credentials you sent into me awhile back but they no longer worked, granting support access will do the trick though :slight_smile:

    Hope you have a great weekend and we'll talk to you soon.

    Cheers,
    Tyler

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.