Hummingbird Browser Caching

I have tried enabling the browser caching in my nginx.conf and it always crashes my network. The file is pasted below, I've tried placing the code given in Hummingbird in several places and none have worked.

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
	worker_connections 768;
	# multi_accept on;
}

http {

#...
        client_max_body_size 600m;
	#...

	##
	# Basic Settings
	##

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 65;
	types_hash_max_size 2048;
	# server_tokens off;

	# server_names_hash_bucket_size 64;
	# server_name_in_redirect off;

	include /etc/nginx/mime.types;
	default_type application/octet-stream;

	##
	# Logging Settings
	##

	access_log /var/log/nginx/access.log;
	error_log /var/log/nginx/error.log;

	##
	# Gzip Settings
	##

	gzip on;
	gzip_disable "msie6";

	 gzip_vary on;
	 #gzip_proxied any;
	 gzip_comp_level 6;
	# gzip_buffers 16 8k;
	# gzip_http_version 1.1;
	 gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

	 etag on;
  expires 7d;
  if_modified_since before;

	##
	# nginx-naxsi config
	##
	# Uncomment it if you installed nginx-naxsi
	##

	#include /etc/nginx/naxsi_core.rules;

	##
	# nginx-passenger config
	##
	# Uncomment it if you installed nginx-passenger
	##

	#passenger_root /usr;
	#passenger_ruby /usr/bin/ruby;

	##
	# Virtual Host Configs
	##

	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;

	ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/dhparams.pem;
}

#mail {
#	# See sample authentication script at:
#	# http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#	# auth_http localhost/auth.php;
#	# pop3_capabilities "TOP" "USER";
#	# imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#	server {
#		listen     localhost:110;
#		protocol   pop3;
#		proxy      on;
#	}
#
#	server {
#		listen     localhost:143;
#		protocol   imap;
#		proxy      on;
#	}
#}
  • Predrag Dubajic

    Hey Site Division,

    Hope you're doing well today :slight_smile:

    Can you tell me where exactly did you try adding the code, it should usually be above HTTP part or inside server section?

    Do you get any errors once it crashes?

    Did you reload NGINX after applying changes?

    Have you checked with your host about this, if you're unsure they should be able to add this for you in no time?

    Looking forward to your response :slight_smile:

    Best regards,
    Predrag

    • Site Division

      Ok, so I am hosting with digital ocean. I found a forum that says this code should be installed in my site server file, after pasting in the code and restarting nginx or rebooting the server, it does not seem to be picking up the code as I'm assuming that the instruction to insert this code will go away and show browser caching enable in Hummingbird as it shows gzip is enabled. I tried pasting it in leaving all current code and also removed the existing like code, which I have in bold.

      The file is pasted below.

      server {
          listen [::]:80 default_server ipv6only=off;
          server_name mysite.com *.mysite.com;
      
          root /usr/share/nginx/sitedivision;
          index index.php index.html index.htm;
      
          location / {
              try_files $uri $uri/ /index.php?$args ;
          }
      
          location ~ /favicon.ico {
              access_log off;
              log_not_found off;
          }
      
          location ~ \.php$ {
              try_files $uri /index.php;
              include fastcgi_params;
              fastcgi_pass unix:/var/run/php5-fpm.sock;
          }
      
          access_log  /var/log/nginx/$host-access.log;
          error_log   /var/log/nginx/wpms-error.log;
      
           # ? See: http://nginx.org/en/docs/http/ngx_http_core_module.html#etag
        # This reduces load on your server by supporting the If-Modified-Since header,
        # since by browsers for static resources.
      
        etag on;
        expires 7d;
        if_modified_since before;
      
        # ? See: http://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip
        # This enables GZIP compression in Nginx, making all static
        # resources load faster in browsers.
      
        gzip on;
        gzip_vary on;
        gzip_comp_level 6;
        gzip_types text/plain text/xml image/svg+xml # text/html in core already.
          application/rss+xml application/atom+xml application/xhtml+xml
          text/css application/json application/x-javascript
          application/font-otf application/font-ttf;
      
        # ? See: http://davidwalsh.name/cdn-fonts
        # This prevents cross-domain security issues related to fonts.
        # Only needed if you use Static CDN Filters in ZenCache.
      
        <strong>location ~* \.(?:ttf|ttc|otf|eot|woff|woff2|css|js)$ {
            add_header Access-Control-Allow-Origin *;
        }</strong>
      
        # ? This is optional, but suggested. It's a flag to tell ZenCache
        # that you completed this Nginx configuration.
      
        location ~* \.php$ {
            fastcgi_param WP_NGINX_CONFIG done;
        }
      } 
      
      server {
      listen 443 ssl;
      server_name mysite.com;
      
      ssl on;
          ssl_certificate /etc/nginx/ssl/ssl-bundle.crt;
          ssl_certificate_key /etc/nginx/ssl/mysite.com.key;
      
           root /usr/share/nginx/sitedivision;
          index index.php index.html index.htm;
      
          location / {
              try_files $uri $uri/ /index.php?$args ;
          }
      
          location ~ /favicon.ico {
              access_log off;
              log_not_found off;
          }
      
          location ~ \.php$ {
              try_files $uri /index.php;
              include fastcgi_params;
              fastcgi_pass unix:/var/run/php5-fpm.sock;
          }
      
         <strong> location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
          }</strong>
      
          access_log  /var/log/nginx/$host-access.log;
          error_log   /var/log/nginx/wpms-error.log;
      
      #enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      
      #Disables all weak ciphers
      ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
      
      ssl_prefer_server_ciphers on;
      }
  • Predrag Dubajic

    Hi Site Division,

    Yup, using bold in code block will only print "strong" tag, but no worries I see where the code is added :slight_smile:

    It seems to me that this should be working and I'm not sure why it's not showing in HB...
    I have forwarded this to plugin developer to check it out but in the meantime could you grant support access so we can have a look at the plugin from back end?

    To enable support access you can follow this guide here:
    http://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Best regards,
    Predrag

  • Predrag Dubajic

    Hi SiteDivision,

    Thanks for granting access, I had a look at your site and noticed that for browser caching you had 5 days selected and the code on right is rendered based on the settings you have selected, so if you added the code but didn't change to 8 days it wouldn't update the settings as there's nothing to update.

    Can you try with this code and see if that works for you:
    http://pastebin.com/UTWyymDK

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.