MyBB Community Forums

Full Version: [Tutorial] 10 Steps for Achieving the Maximum Possible Speed for Your MyBB Forum!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Thank you so much for this tut!
One more tip you could add to this is Mod_Deflate.

If you are running a Apache Web Serve Mod_Deflate comes pre-installed. You will just need to enable it. Mod_Deflate is a compression tool. Unlike enabling the gzip function of MyBB this will also compress files not belonging to MyBB. It is also a lot less resource hungry. So won't slow the sever down when the site gets busy.

If you haven't got one make an empty file called .htaccess
Then just place this into it.

<IfModule mod_deflate.c>
    <IfModule mod_setenvif.c>
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
    </IfModule>
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
    AddOutputFilterByType DEFLATE text/css application/x-javascript text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon
</IfModule>
<FilesMatch "\.(css|js)$">
    <IfModule mod_headers.c>
        Header set Pragma "public"
        Header set Cache-Control "public, must-revalidate, proxy-revalidate"
    </IfModule>
    FileETag MTime Size
    <IfModule mod_headers.c>
         Header set X-Powered-By "W3 Total Cache/0.9.1.3"
    </IfModule>
</FilesMatch>
<FilesMatch "\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$">
    <IfModule mod_headers.c>
        Header set Pragma "public"
        Header set Cache-Control "public, must-revalidate, proxy-revalidate"
    </IfModule>
    FileETag MTime Size
    <IfModule mod_headers.c>
         Header set X-Powered-By "W3 Total Cache/0.9.1.3"
    </IfModule>
</FilesMatch>
<FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$">
    <IfModule mod_headers.c>
        Header set Pragma "public"
        Header set Cache-Control "public, must-revalidate, proxy-revalidate"
    </IfModule>
    FileETag MTime Size
    <IfModule mod_headers.c>
         Header set X-Powered-By "W3 Total Cache/0.9.1.3"
    </IfModule>
</FilesMatch>
If you already have one just place the code into the bottom.

Upload it to the root and thats it. As nearly all shared hosts run on Apache this will help out a lot of people. The results will be instant and you will see a huge improvement.
@pinguy The GZip option in MyBB covers that, but thanks for posting that htaccess code, I've added it to Evernote for future reference Smile
(2011-08-28, 02:25 AM)lucasbytegenius Wrote: [ -> ]@pinguy The GZip option in MyBB covers that, but thanks for posting that htaccess code, I've added it to Evernote for future reference Smile

Only for Mybb Files. How about the ones you have added? Just give it ago. You can run this with the gzip function of mybb still enabled.

You will see an pretty big improvement.
I'll definitely try it out, thanks Smile
Just followed a guide from here about a php script that does combining and compressing javascript and css files.

http://rakaz.nl/2006/12/make-your-pages-...files.html

You could make it work with css files on mybb but as the cache directory changes every time you edit the theme I wouldn't recommend it. But for javascripts it works really well.

All you need to do is add this to your .htaccess

RewriteEngine on
RewriteBase /
RewriteRule ^jscripts/(.*\.js) /combine.php?type=javascript&files=$1

Then download this php file and call it combine.php, open it up and replace javascript with jscripts. Save the file and upload it to root.

If it worked you will start seeing javascript.gzip files in you cache directory. If you don't then something isn't working. It maybe that gzip isn't installed on the server.

I haven't fully tested this yet so not sure if there is any draw backs, but it seems to be working fine for me at the moment.
That's quite an old article, but could it still work? I guess I'll give it a try later on. Smile
(2011-08-28, 06:19 AM)pinguy Wrote: [ -> ]Just followed a guide from here about a php script that does combining and compressing javascript and css files.

http://rakaz.nl/2006/12/make-your-pages-...files.html

You could make it work with css files on mybb but as the cache directory changes every time you edit the theme I wouldn't recommend it. But for javascripts it works really well.

All you need to do is add this to your .htaccess

RewriteEngine on
RewriteBase /
RewriteRule ^jscripts/(.*\.js) /combine.php?type=javascript&files=$1

Then download this php file and call it combine.php, open it up and replace javascript with jscripts. Save the file and upload it to root.

If it worked you will start seeing javascript.gzip files in you cache directory. If you don't then something isn't working. It maybe that gzip isn't installed on the server.

I haven't fully tested this yet so not sure if there is any draw backs, but it seems to be working fine for me at the moment.

Sounds similar to head.js.
I ended up removing the php script. I didn't really see any improvements using it.
Great thread! Thanks!
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17