Skip to content

Commit

Permalink
README.md, index.php: support Lighttpd
Browse files Browse the repository at this point in the history
  • Loading branch information
janmoesen committed Oct 29, 2011
1 parent 072b035 commit edbe060
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 8 deletions.
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
# jsPerf.com source code

[jsPerf.com](http://jsperf.com/) runs on a Linux server with Apache, MySQL(i) and PHP installed.
[jsPerf.com](http://jsperf.com/) runs on a server with Apache or Lighttpd,
MySQL and PHP installed.

## How to run a local copy of jsPerf for testing/debugging

1. Download the source code, as located within this repository.
2. The code expects things to be hosted at `/` and not a subdirectory. You might want to create a new virtual host, e.g. `dev.jsperf.com`.
2. The code expects things to be hosted at `/` and not a subdirectory. You
might want to create a new virtual host, e.g. `dev.jsperf.com`.
3. Use `database.sql` to create the jsPerf tables in a database of choice.
4. Rename `_inc/config.sample.php` to `config.php` and enter your database credentials and other info.
5. Edit `.htaccess` (especially the first few lines) so it matches your current setup.
4. Rename `_inc/config.sample.php` to `config.php` and enter your database
credentials and other info.
5. If you are using Apache, edit `.htaccess` (especially the first few lines)
so it matches your current setup. If you are using Lighttpd, set up the
`dev.jsperf.com` virtual host using the sample in `_inc/lighttpd.conf`.

## License

The source code for [jsPerf](http://jsperf.com/) is copyright © [Mathias Bynens](http://mathiasbynens.be/) and dual-licensed under the MIT and GPL licenses.
The source code for [jsPerf](http://jsperf.com/) is copyright
© [Mathias Bynens](http://mathiasbynens.be/) and dual-licensed under the MIT
and GPL licenses.

You don’t have to do anything special to choose one license or the other and you don’t have to notify anyone which license you are using. You are free to re-use parts of this code in commercial projects as long as the copyright header (as mentioned in `GPL-LICENSE.txt` and `MIT-LICENSE.txt`) is left intact.
You don’t have to do anything special to choose one license or the other and
you don’t have to notify anyone which license you are using. You are free to
re-use parts of this code in commercial projects as long as the copyright
header (as mentioned in `GPL-LICENSE.txt` and `MIT-LICENSE.txt`) is left
intact.
51 changes: 51 additions & 0 deletions _inc/lighttpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
$HTTP["host"] == "dev.jsperf.com" {
# Change this to match your location.
server.document-root = "/var/www/dev.jsperf.com"
server.error-handler-404 = "/404"

# Set up PHP-CGI with FastCGI.
fastcgi.server = (
".php" => ((
# Change this to point to your php-cgi binary.
"bin-path" => "/opt/local/bin/php-cgi",
"socket" => "/tmp/php-fcgi.socket",
"min-procs" => 1,
"max-procs" => 4,
"idle-timeout" => 20,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "3",
"PHP_FCGI_MAX_REQUESTS" => "1000"
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
))
)

# Make sure we are using one of the known hostnames.
$HTTP["host"] !~ "^(a\.|dev\.)?jsperf\.com\.?$" {
url.redirect += (
"^/(.*)" => "http://jsperf.com.kak/$1"
)
}

url.rewrite-if-not-file += (
# Enable versioned CSS and JS resources.
"^(.*).css$" => "_css/main.css",
"^(.*)(-[0-9]+)?.js$" => "_js/$1.js",

# Enable pretty URLs.
"^/browse/([a-z0-9-]+).atom/?$" => "index.php?slug=browseAuthor&author=$1&atom=true",
"^/browse/([a-z0-9-]+)/?$" => "index.php?slug=browseAuthor&author=$1",
"^/(edit|delete)-comment/([0-9]+)/?$" => "index.php?slug=$1Comment&id=$2",
"^/([a-z0-9-]+)/([0-9]+)/(edit|delete|publish|embed|dev)/?$" => "index.php?slug=$1&rev=$2&action=$3",
"^/([a-z0-9-]+)/([0-9]+).atom/?$" => "index.php?slug=$1&rev=$2&atom=true",
"^/([a-z0-9-]+)/([0-9]+)/?$" => "index.php?slug=$1&rev=$2",
"^/([a-z0-9-]+)/(edit|delete|publish|embed|dev)/?$" => "index.php?slug=$1&action=$2",
"^/([a-z0-9-]+).xml" => "index.php?slug=$1.xml",
"^/([a-z0-9-]+).atom" => "index.php?slug=$1&atom=true",
"^/([a-z0-9-]+)?" => "index.php?slug=$1",
"^/api/(jsonp)$" => "_api/$1.php",
)
}
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

$home = $jsClass = $benchmark = $showAtom = $mainJS = $author = $update = $nameError = $mailError = $msgError = $slugError = $spamError = $codeError = $codeTitleError = $titleError = $error = $author = $authorEmail = $authorURL = $ga = $embed = false;

if (isset($_GET['slug'])) {
if (!empty($_GET['slug'])) {
$slug = $_GET['slug'];
$rev = isset($_GET['rev']) ? (int) $_GET['rev'] : 1;
$action = isset($_GET['action']) && in_array($_GET['action'], $reservedActions) ? $_GET['action'] : false;
Expand Down Expand Up @@ -102,4 +102,4 @@
require('index.tpl');
}

?>
?>

0 comments on commit edbe060

Please sign in to comment.