Skip to content

Instantly share code, notes, and snippets.

@bool-dev
Forked from jmervine/nginx.conf
Created May 27, 2016 11:15
Show Gist options
  • Save bool-dev/031cfd05e3defa19466e50df6be8207a to your computer and use it in GitHub Desktop.
Save bool-dev/031cfd05e3defa19466e50df6be8207a to your computer and use it in GitHub Desktop.

Revisions

  1. @jmervine jmervine revised this gist Feb 11, 2014. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,9 @@
    #
    # See below for urls.txt example.
    #
    # Matches should be in /tmp/match.log with a 200 status.
    #
    # Everything else should be in /tmp/access.log with a 404 status.

    worker_processes 1;
    http {
  2. @jmervine jmervine renamed this gist Feb 11, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @jmervine jmervine created this gist Feb 11, 2014.
    11 changes: 11 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    http://localhost:8888/good1
    http://localhost:8888/good2
    http://localhost:8888/good3
    http://localhost:8888/bad1
    http://localhost:8888/bad2
    http://localhost:8888/bad3
    http://localhost:8888/good4
    http://localhost:8888/bad4
    http://localhost:8888/good5
    http://localhost:8888/bad5

    40 changes: 40 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    # Usage:
    #
    # Start with:
    #
    # sudo /use/local/sbin/nginx -c /path/to/this/nginx.conf
    #
    # Tail logs:
    #
    # $ sudo tail -f /tmp/access.log /tmp/error.log /tmp/match.log
    #
    # Generate load:
    #
    # $ cat ./urls.txt | xargs curl -i
    #
    # See below for urls.txt example.
    #

    worker_processes 1;
    http {
    include /usr/local/etc/nginx/mime.types;
    default_type application/octet-stream;

    log_format main '$status $request'; # e.g. "200 GET /foo HTTP/1.1"
    access_log /tmp/access.log main;
    error_log /tmp/error.log;

    server {
    listen 8888;
    server_name localhost;

    location ~ ^/good[0-9]$ { # << regex here
    access_log /tmp/match.log main;
    return 200;
    }

    location / {
    return 404;
    }
    }
    }