• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Quickly and Greatly speed up your XenForo

Junior

Well-known member
A default setup of XenForo statistics and speed:
Total Page Size: 357kb
http://gtmetrix.com/reports/xfproud.com/Dpk7form

After this guide:
Total Page Size: 172kb
http://gtmetrix.com/reports/xfproud.com/vmWjnTCF
Ignore load time, it changes based on how fast it responds to the server during the test and a few other factors.

After this guide your site should be loading almost instantly. Even a larger site. There are other server side methods to speed up your site but these are simple and quick fixes. I repeated all this and created the guide in less than an hour.

XFOptimize
A must have. This will compress whitespace and javascript on your site and cause noticeable differences right away.
http://xenforo.com/community/threads/xf-optimise.14021/

Remove Sidebar Share Page
This is a simple way to increase your front page load time. Simply open the template sidebar_share_page and delete its content. Anytime you would like to re-add this to the sidebar, simply revert the template.

By doing this you will minimize DNS look up on the front page.

Host Jquery with google
By not hosting the file yourself and by allowing google to host it, users that have downloaded it from google before will load it a lot faster. To change this go into your Admin Panel and navigate to Home > Options > Performance. Set the Jquery source to Google Ajax API CDN.

Cookie Free Domain
This is rather tedious way to speed up your site but a great way one.

1. Create a subdomain (if you don't know how to do this, contact your host provider). I generally name mine static. So it'll be http://static.YOURSITE.com
2. Move your skin folder and XenForo folder to the root of the subdomain folder.
3. In your admin control panel go to Appearance > Style Properties > General > Settings > Path to Image. Change it to http://static.YOURSITE.com
4. Now go to Header and Navigation change the logo paths to http://static.YOURSITE.com/xenforo/logo.png
5. Now go to Forum List and change each forum icon path to http://static.YOURSITE.com/xenforo/widgets/FORUMICON.png
6. After using XFOptomize, move your js folder to your subdomain folder. In your Admin Panel, navigate to Home > Options > Performance. Set the option_JavascriptSource to http://static.YOURSITE.com/js
7. If you use a custom skin go you'll have to go through and find any custom image and change its link to http://static.YOURSITE.com/CUSTOMSKIN/IMAGELINK

Check GTMetrix under YSLOW tab > 'User cookie-free domain' to ensure all images are part of a cookieless domain.

Compress your images with Smush.it
smushed.webp
Smush.it compresses your images to help quicken the load time. GTMetrix will help with images not compressed, but for all other default XenForo images, I have uploaded them here. I'll try to keep this up to date as often as possible.

Cache Control and Header Expires
Simply adding Cache Control and header expire to your .htaccess file can greatly speed up your sites speed by cacheing just about everything. Here is my current set up, add it to the top of your file.

It is recommended that you do this last. Your members may have larger files and older non compressed images cached if you do this at the start.

Code:
Header unset Pragma
FileETag None
Header unset ETag

# 1 YEAR
<FilesMatch "\.(ico|pdf|flv)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
# 1 WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
# 2 DAYS 172800
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=604800, proxy-revalidate"
</FilesMatch>
# 1 MIN
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=60, private, proxy-revalidate"
</FilesMatch>

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Thu, 15 Dec 2011 20:00:00 GMT"
</FilesMatch>
 

Attachments

1. Create a subdomain (if you don't know how to do this, contact your host provider). I generally name mine static. So it'll be http://static.YOURSITE.com
2. Move your skin folder and XenForo folder to the root of the subdomain folder.

That's IMHO unneccesary;)
Just make a subdomain and link from the original image & js directory to the subdomain;)
So you don't need to care on each xenforo upgrade, if all images & js files are up2date or if some are missing
 
AFAIK cookie free domain wont work if you use same domain name as forum domain i.e.

subdomain.forumdomain.com = won't work as forumdomain.com cookie still gets tagged on
subdomain.forumdomain.net = different domain/extension to forum = works as no cookies exist

but the pain and trouble with different domain isn't work the hassle as folks with noscript/ad blocks sometimes will have different extension domain blocked so screws up functionality of your forums unless you add a forum wide notice as well as specific note to all welcome emails for members to allow your forumdomain.net through their ad blockers etc.

I just like subdomain.forumdomain.com for mine it ain't cookieless but at least it allows faster loading of concurrent objects if you limit number of objects to less than 8 to 10 per subdomain.

But if you put varnish cache in front of your web server you can configure it to strip cookies from static files so even on subdomain.forumdomain.com it is relatively cookieless. Unfortunately, having issues with varnish cache and Xenforo's interaction with IE browsers - no probs in Firefox.
Also for server performance you should limit htaccess usage and move the mod_expires and caching syntax into apache httpd.conf i.e. if you have mod_expires and mod_deflate installed and loaded in Apache in httpd.conf at

Code:
<IfModule mod_deflate.c>
DeflateCompressionLevel 3

<Location / >
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ \
    no-gzip dont-vary
SetEnvIfNoCase Request_URI \
    \.(?:exe|t?gz|zip|bz2|sit|rar)$ \
    no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary

BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent env=!dont-vary
</Location>
</IfModule>

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType application/x-javascript A1209600
    ExpiresByType text/javascript A1209600
    ExpiresByType application/javascript A1209600
    ExpiresByType text/css A1209600
    ExpiresByType image/x-icon A2592000
    ExpiresByType image/icon A2592000
    ExpiresByType application/x-ico A2592000
    ExpiresByType application/ico A2592000
    ExpiresByType image/gif A2592000
    ExpiresByType image/jpeg A604800
    ExpiresByType image/jpg A604800
    ExpiresByType image/png A604800
    ExpiresByType application/x-shockwave-flash A604800
</IfModule>
 
What do you mean exactly? Ok for the subdomain but where do I create or modify the link?

Basically you create a new server on your subdomain and make the server root the directory above the image and js directories. Then when you upgrade the main forum the subdomain is automatically upgraded as it is pointing to the same physical location.
 
Code:
Header unset Pragma
FileETag None
Header unset ETag

# 1 YEAR
<FilesMatch "\.(ico|pdf|flv)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
# 1 WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
# 2 DAYS 172800
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=604800, proxy-revalidate"
</FilesMatch>
# 1 MIN
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=60, private, proxy-revalidate"
</FilesMatch>

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Thu, 15 Dec 2011 20:00:00 GMT"
</FilesMatch>

This just gives me error 500's everywhere
 
What do you mean exactly? Ok for the subdomain but where do I create or modify the link?

Did you understand what he was saying? When you create your subdomain, instead of putting it in a directory of its own you make the subdomain directory the same as your XenForo install. So your website will be:
Yourwebsite.com/xenforo

But everything will also link by doing:
static.yourwebsite.com/xenforo

Be sure to still redirect all images and files to static.yourwebsite.com/xenforo
 
This just gives me error 500's everywhere

Break it up, there are a couple things going on in that file. Try removing the top 3 lines, then the Cache-Control section and finally the last line Header set Expires. See which sets are causing the problem, you may need to contact your host.

Have you added anything else to your .htaccess and are you placing this at the top?
 
Break it up, there are a couple things going on in that file. Try removing the top 3 lines, then the Cache-Control section and finally the last line Header set Expires. See which sets are causing the problem, you may need to contact your host.

Have you added anything else to your .htaccess and are you placing this at the top?
I'll play with it some more later

Am close to the default xenforo .htaccess the only extra is the www. to none and php upload limit
Code:
## Expires
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 seconds"
    ExpiresByType text/html "access plus 1 seconds"
    ExpiresByType image/gif "access plus 3456000 seconds"
    ExpiresByType image/jpeg "access plus 3456000 seconds"
    ExpiresByType image/png "access plus 3456000 seconds"
    ExpiresByType text/css "access plus 3456000 seconds"
    ExpiresByType text/javascript "access plus 3456000 seconds"
    ExpiresByType application/javascript "access plus 3456000 seconds"
    ExpiresByType application/x-javascript "access plus 3456000 seconds"
</IfModule>

#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>
 
RewriteCond %{HTTP_HOST} ^www\.animelon\.com
RewriteRule (.*) http://animelon.com/$1 [R=301,L]

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
    RewriteEngine On

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data|js|styles|install) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>

php_value upload_max_filesize 64M
php_value post_max_size 64M
 
Whats all the expiresbytype on the top?

That could be conflicting with the last line of what I had you add.
 
Whats all the expiresbytype on the top?

That could be conflicting with the last line of what I had you add.
No idea it was in the default .htaccess (I think) ive not added anything other than the

Code:
RewriteCond %{HTTP_HOST} ^www\.animelon\.com
RewriteRule (.*) http://animelon.com/$1 [R=301,L]

Unless wordpress added that
 
Try overwriting that and see what happens. They are both doing the same thing. That is just telling each file to expire at a different time instead of having them all expire at the date placed in my code. This isn't really needed since XenForo has the query code at the end of the Javascript and CSS files.
 
Try overwriting that and see what happens. They are both doing the same thing. That is just telling each file to expire at a different time instead of having them all expire at the date placed in my code. This isn't really needed since XenForo has the query code at the end of the Javascript and CSS files.
Same mate
 
If or when you get a chance try the method I suggested earlier, your server may not support one of the methods. I'll get you another method if your host can't solve it for you.
Same without the top three
My server is raw where the only help I would get is if it sets on fire
Nps anyway cheers tho
 
Top Bottom