Skip to content

Setup WebPagetest Website

siedi edited this page Jan 5, 2016 · 2 revisions

The "official" setup is described here.

I'm running my instance on a virtual server, Debian Jessie with nginx and PHP7 (as of Jan. 2016). The setup is quite simple (assuming you have your webserver with nginx and PHP7 already running).

  • Clone the webpagetest repository:

    cd /var/www/
    git clone https://github.com/WPO-Foundation/webpagetest.git
  • Change the owner of the www folder to the www-data-user (nginx is running at)

    chown -R www-data. /var/www/webpagetest/www/
  • And change the permissions of some folders according to the official setup guide (not sure if this is all needed)

    cd /var/www/webpagetest/www/
    mkdir -p tmp dat results work/jobs work/video logs
    chmod u+w tmp dat results work/jobs work/video logs
  • Create all the settings, we use the sample ones

    cd /var/www/webpagetest/www/settings
    for f in *.sample; do cp "$f" "`echo $f | sed s/\.sample//`"; done
    chown www.data. *.ini

    For now we are done with the settings, we will make the necessary changes later, especially the locations.ini

  • nginx config

    I have my vhost config files in /etc/nginx/sites-enabled. The official wpt repository provides a config snippet for nginx. Based on that we create a new file named webpagetest (make your necessary changes):

    server {
      listen 80;
      root /var/www/webpagetest/www/;
      index index.php;
    
      server_name webpagetest.your_hostname.com;
    
      client_max_body_size 10m;
    
      location ~ \.php$ {
        try_files $uri =404;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param  HTTP_MOD_REWRITE On;
      }
    
      include /var/www/webpagetest/www/nginx.conf;
    }
    

    Test your new nginx config nginx -t and if it is ok, restart your webserver systemctl restart nginx.service

    Please be aware, we do not have any authentication / security enabled, so anybody can access it. (We might cover it later).

  • Your are ready to go. Open the website in your browser. You should see a similar page as at http://www.webpagetest.org. Proceed with the agent and location setup.