2 Nginx vHost for PHP version
Perflyst edited this page 2020-03-23 12:15:11 +01:00

The following virtual host can be used to expose the PHP version of librespeed. You need to edit the domain, the document root and the path to the SSL certificate.

server {
  listen 80;
  listen [::]:80;
  server_name librespeed.example.org;

  root /var/www/speedtest;
  client_max_body_size 21M;

  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
  }

  access_log /dev/null;
  error_log /dev/null;
}

server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;

  server_name librespeed.example.org;

  ssl_certificate /path/to/fullchain.pem;
  ssl_certificate_key /path/to/privkey.pem;
  ssl_trusted_certificate /path/to/chain.pem;

  root /var/www/speedtest;
  client_max_body_size 21M;

  location ~ \.php$ {
    include /etc/nginx/misc/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
  }

  access_log /dev/null;
  error_log /dev/null;
}