Skip to content

Files

Latest commit

author
sitestress
Mar 1, 2016
ef5829c · Mar 1, 2016

History

History

www

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jun 28, 2013
Feb 24, 2016
Dec 7, 2015
Feb 23, 2016
Feb 23, 2016
Feb 24, 2014
Jun 28, 2013
Jan 4, 2016
Jan 22, 2016
Sep 11, 2013
Jun 1, 2015
Feb 8, 2016
Oct 21, 2014
Feb 17, 2015
Feb 24, 2016
Jun 28, 2013
Jan 28, 2016
Jan 22, 2016
Jan 7, 2015
Mar 23, 2015
Jul 9, 2014
Feb 7, 2016
Feb 22, 2016
Jul 15, 2015
Feb 3, 2016
Nov 16, 2014
Jun 3, 2014
Jul 4, 2013
Feb 24, 2014
Mar 3, 2015
Feb 11, 2016
Jun 28, 2013
Feb 10, 2016
Jun 28, 2013
Jun 17, 2014
Apr 29, 2015
Nov 11, 2014
Jun 4, 2015
Apr 1, 2015
Sep 17, 2015
Aug 25, 2015
Jan 11, 2016
Feb 22, 2016
Feb 24, 2016
Apr 27, 2015
Jun 28, 2013
Feb 12, 2015
Oct 21, 2014
Dec 3, 2015
Jun 28, 2013
Dec 11, 2015
May 27, 2014
Dec 29, 2014
Dec 3, 2015
Jan 4, 2016
Jun 4, 2015
Jun 4, 2015
Jun 28, 2013
Oct 23, 2014
Feb 22, 2016
Jun 28, 2013
Jan 30, 2014
Dec 17, 2014
Jun 28, 2013
Mar 4, 2014
Feb 9, 2016
Feb 9, 2016
May 21, 2015
Jan 12, 2015
Feb 29, 2016
Sep 23, 2015
Jun 28, 2013
Jun 28, 2013
Jul 28, 2014
May 8, 2015
Jul 19, 2015
Feb 5, 2016
Jun 28, 2013
Apr 29, 2015
Feb 22, 2016
Oct 23, 2015
Nov 11, 2014
Oct 21, 2014
Oct 21, 2014
Jan 22, 2014
Feb 29, 2016
Feb 29, 2016
Dec 18, 2014
Jan 7, 2015
Dec 22, 2013
Oct 23, 2015
Feb 5, 2016
Sep 12, 2013
Jun 10, 2014
Dec 3, 2015
Jan 8, 2016
Feb 26, 2016
Jan 7, 2015
Jun 28, 2013
Jan 7, 2015
Jul 1, 2015
Dec 3, 2015
Jun 28, 2013
Jul 15, 2015
Jul 15, 2015
Jan 7, 2015
Feb 17, 2015
May 29, 2014
Feb 5, 2016
Feb 8, 2016
Feb 29, 2016
Jan 7, 2015
Oct 28, 2014
Jun 25, 2015
Jul 31, 2014
May 4, 2015
Mar 1, 2016
Dec 3, 2015
Jan 7, 2015
Feb 17, 2015
Aug 24, 2015
Jan 7, 2015
Jun 28, 2013
Jul 15, 2015
Dec 3, 2015
Jan 7, 2015
Jan 7, 2015
Jan 4, 2016
Jan 7, 2015
Jul 9, 2015
Jan 7, 2015
Dec 22, 2013
Jun 28, 2013
Jun 5, 2015
Jan 4, 2016
Dec 3, 2015
Feb 5, 2016
Oct 20, 2015
Here are the rules that you need to add to a server configuration for Nginx to operate as a WebPagetest server.  Make sure to change the script path in the fcgi section.

        location / {
                index  index.php;
        }

        # disable chunked encoding for mp4 files because it breaks flash video on firefox
        location ~* \.mp4 {
                gzip off;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        location ~ /\.ht {
                deny  all;
        }

        # block protected files
        location ~* \.(gz|ini|inc) {
                deny all;
        }

        #webpagetest rewrite rules
        rewrite ^/about$ /about.php last;
        rewrite ^/traceroute$ /traceroute.php last;
        rewrite ^/mobile$ /mobile.php last;
        rewrite ^/tips$ /tips.php last;
        rewrite ^/pss$ /pss.php last;
        rewrite ^/compare$ /pss.php last;
        rewrite ^/blink$ /blink.php last;

        #result paths
        rewrite ^/result/([a-zA-Z0-9_]+)$ /result/$1/ permanent;
        rewrite ^/result/([a-zA-Z0-9_]+)/$ /results.php?test=$1 last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/waterfall$ /result/$1/$2/details/ permanent;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/waterfall/$ /result/$1/$2/details/ permanent;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/details/$ /details.php?test=$1&run=$2  last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/waterfall/cached$ /result/$1/$2/details/cached/ permanent;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/waterfall/cached/$ /result/$1/$2/details/cached/ permanent;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/details/cached/$ /details.php?test=$1&run=$2&cached=1  last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/optimization$ /result/$1/$2/performance_optimization/ permanent;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/optimization/$ /result/$1/$2/performance_optimization/ permanent;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/performance_optimization/$ /performance_optimization.php?test=$1&run=$2  last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/optimization/cached$ /result/$1/$2/performance_optimization/cached/ permanent;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/optimization/cached/$ /result/$1/$2/performance_optimization/cached/ permanent;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/performance_optimization/cached/$ /performance_optimization.php?test=$1&run=$2&cached=1 last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/screen_shot/$ /screen_shot.php?test=$1&run=$2 last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/screen_shot/cached/$ /screen_shot.php?test=$1&run=$2&cached=1 last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/breakdown/$ /breakdown.php?test=$1&run=$2 last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/breakdown/cached/$ /breakdown.php?test=$1&run=$2&cached=1 last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/domains/$ /domains.php?test=$1&run=$2 last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/domains/cached/$ /domains.php?test=$1&run=$2&cached=1 last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/optimization_report/$ /optimization_report.php?test=$1&run=$2 last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/optimization_report/cached/$ /optimization_report.php?test=$1&run=$2&cached=1 last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/pagespeed/$ /pagespeed.php?test=$1&run=$2 last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)/pagespeed/cached/$ /pagespeed.php?test=$1&run=$2&cached=1 last;
        rewrite ^/testlog/([0-9]+)$ /testlog/$1/ permanent;
        rewrite ^/testlog/([0-9]+)/$ /testlog.php?days=$1 last;
        rewrite ^/xmlResult/([a-zA-Z0-9_]+)/$ /xmlResult.php?test=$1 last;
        rewrite ^/testlog.csv /testlog.php?f=csv last;
        rewrite ^/waterfall.png /waterfall.php last;

        #old direct path to images
        rewrite ^/results/([a-zA-Z0-9])([a-zA-Z0-9]+)/([a-zA-Z0-9_]+).png$ /results/old/_$1/$1$2/$3.png last;
        rewrite ^/results/([a-zA-Z0-9])([a-zA-Z0-9]+)/([a-zA-Z0-9_]+).jpg$ /results/old/_$1/$1$2/$3.jpg last;
        rewrite ^/results/old/_([a-zA-Z0-9])/([a-zA-Z0-9]+)/([a-zA-Z0-9_]+).png$ /results/old/$2/$3.png last;

        #csv combined results
        rewrite ^/result/([a-zA-Z0-9_]+)/.*page_data.csv$ /csv.php?test=$1 last;
        rewrite ^/result/([a-zA-Z0-9_]+)/.*requests.csv$ /csv.php?test=$1&requests=1 last;

        #thumbnails
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_screen_thumb.jpg$ /thumbnail.php?test=$1&run=$2&file=$2_screen.jpg last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_Cached_screen_thumb.jpg$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_screen.jpg last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_waterfall_thumb.png$ /thumbnail.php?test=$1&run=$2&file=$2_waterfall.png last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall_thumb.png$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_waterfall.png last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_optimization_thumb.png$ /thumbnail.php?test=$1&run=$2&file=$2_optimization.png last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization_thumb.png$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_optimization.png last;

        #old direct thumbnail paths
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_screen_thumb.jpg$ /thumbnail.php?test=$1&run=$2&file=$2_screen.jpg last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_screen_thumb.jpg$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_screen.jpg last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_waterfall_thumb.png$ /thumbnail.php?test=$1&run=$2&file=$2_waterfall.png last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall_thumb.png$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_waterfall.png last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_optimization_thumb.png$ /thumbnail.php?test=$1&run=$2&file=$2_optimization.png last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization_thumb.png$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_optimization.png last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_waterfall_thumb.gif$ /thumbnail.php?test=$1&run=$2&file=$2_waterfall.gif last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall_thumb.gif$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_waterfall.gif last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_optimization_thumb.gif$ /thumbnail.php?test=$1&run=$2&file=$2_optimization.gif last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization_thumb.gif$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_optimization.gif last;

        # waterfalls
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_waterfall.png$ /waterfall.php?test=$1&run=$2 last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall.png$ /waterfall.php?test=$1&run=$2&cached=1 last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_waterfall.gif$ /waterfall.php?test=$1&run=$2 last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall.gif$ /waterfall.php?test=$1&run=$2&cached=1 last;
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([0-9]+)_waterfall.png$ /waterfall.php?test=$1$2$3_$4&run=$5 last;
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)_waterfall.png$ /waterfall.php?test=$1$2$3_$4_$5&run=$6 last;
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall.png$ /waterfall.php?test=$1$2$3_$4&run=$5&cached=1 last;
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall.png$ /waterfall.php?test=$1$2$3_$4_$5&run=$6&cached=1 last;
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([0-9]+)_connection.png$ /waterfall.php?test=$1$2$3_$4&run=$5&type=connection last;
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)_connection.png$ /waterfall.php?test=$1$2$3_$4_$5&run=$6&type=connection last;
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([0-9]+)_Cached_connection.png$ /waterfall.php?test=$1$2$3_$4&run=$5&cached=1&type=connection last;
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)_Cached_connection.png$ /waterfall.php?test=$1$2$3_$4_$5&run=$6&cached=1&type=connection last;

        # optimization checklists
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_optimization.png$ /optimizationChecklist.php?test=$1&run=$2 last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization.png$ /optimizationChecklist.php?test=$1&run=$2&cached=1 last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_optimization.gif$ /optimizationChecklist.php?test=$1&run=$2 last;
        rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization.gif$ /optimizationChecklist.php?test=$1&run=$2&cached=1 last;
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([0-9]+)_optimization.png$ /optimizationChecklist.php?test=$1$2$3_$4&run=$5 last;
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)_optimization.png$ /optimizationChecklist.php?test=$1$2$3_$4_$5&run=$6 last;
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization.png$ /optimizationChecklist.php?test=$1$2$3_$4&run=$5&cached=1 last;
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization.png$ /optimizationChecklist.php?test=$1$2$3_$4_$5&run=$6&cached=1 last;

        #location cookie dropping
        rewrite ^/loc/([a-zA-Z0-9_]+)$ /util/setloc.php?location=$1 last;
        rewrite ^/loc/([a-zA-Z0-9_]+)$/ /util/setloc.php?location=$1 last;

        #gzip compressed text result files
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+).(txt|csv)$ /gettext.php?test=$1$2$3_$4&file=$5.$6 last;
        rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+).(txt|csv)$ /gettext.php?test=$1$2$3_$4_$5&file=$6.$7 last;

        #tcpdump capture files
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+).cap$ /getgzip.php?test=$1&file=$2.cap last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_Cached.cap$ /getgzip.php?test=$1&file=$2_Cached.cap last;

        #page speed
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_pagespeed.txt$ /getgzip.php?test=$1&file=$2_pagespeed.txt last;
        rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_Cached_pagespeed.txt$ /getgzip.php?test=$1&file=$2_Cached_pagespeed.txt last;

        #embeddable video widget
        rewrite ^/video/embed/([a-zA-Z0-9_]+)$ /video/view.php?embed=1&id=$1 last;
        
        #widgets
        rewrite ^/widgets/pagespeed/tree$ /widgets/pagespeed/tree.php last;

        #old pages that were eliminated in the UI rewrite
        rewrite ^/test$ / permanent;

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                fastcgi_pass   127.0.0.1:9000;
                #fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  /var/www/webpagetest.org$fastcgi_script_name;
                fastcgi_param  HTTP_MOD_REWRITE On;
                include fastcgi_params;
        }

        # static files
        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires max;
            log_not_found off;
        }