-
-
Save tvpmb/3013922 to your computer and use it in GitHub Desktop.
nginx configuration for running jquery unit tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# jQuery Unit Test Configuration File. | |
# Copyright 2012, Tim Branyen (@tbranyen) | |
# This configuration file may be freely distributed under the MIT license. | |
# | |
# Include this file (named jquery.conf) alongside the jquery folder and run | |
# with root privileges: | |
# | |
# sudo nginx -c /absolute/path/to/jquery.conf | |
# | |
# To stop the server simply run: | |
# | |
# sudo nginx -s stop | |
# | |
# Single process server. | |
worker_processes 1; | |
# Set simple work connection defaults. | |
events { worker_connections 64; } | |
http { | |
# Change this location to be where your mime.types file is. | |
include /usr/local/etc/nginx/mime.types; | |
server { | |
# Point dir to the directory that contains the jquery folder. You will | |
# access the tests via http://localhost/jquery/test/. | |
set $dir /absolute/path/to/jquery/parent; | |
# This is the url to where PHP fcgi is running, these are sane defaults, | |
# you will most likely not need to change these. | |
set $cgi 127.0.0.1:9000; | |
# Change these to go wherever you like, definitely change on Windows. | |
access_log /tmp/jquery_access.log; | |
error_log /tmp/jquery_error.log; | |
# Change these if you need to, defaults are fine. | |
listen 80; | |
server_name localhost; | |
# Set the server root to point to where jQuery is included. | |
root $dir; | |
# Required to be able to POST to an HTML file. | |
error_page 405 = $uri; | |
location @405 { | |
root $dir; | |
} | |
# Set up PHP your own way; here I'm using php-fpm package from brew. | |
location ~ \.php { | |
fastcgi_param QUERY_STRING $query_string; | |
fastcgi_param REQUEST_METHOD $request_method; | |
fastcgi_param CONTENT_TYPE $content_type; | |
fastcgi_param CONTENT_LENGTH $content_length; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
fastcgi_param REQUEST_URI $request_uri; | |
fastcgi_param DOCUMENT_URI $document_uri; | |
fastcgi_param DOCUMENT_ROOT $document_root; | |
fastcgi_pass $cgi; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment