Skip to content

Instantly share code, notes, and snippets.

@robertlemke
Created July 23, 2013 17:37
Show Gist options
  • Select an option

  • Save robertlemke/6064401 to your computer and use it in GitHub Desktop.

Select an option

Save robertlemke/6064401 to your computer and use it in GitHub Desktop.

Revisions

  1. Robert Lemke created this gist Jul 23, 2013.
    172 changes: 172 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,172 @@
    worker_processes 1;

    events {
    worker_connections 1024;
    }


    http {

    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;

    root /Users/robert/Sites;

    server {
    listen 80;
    server_name localhost;

    location / {
    index index.php index.html;
    }

    location ~ \.php$ {
    fastcgi_pass 127.0.0.1:9000;

    include fastcgi_params;
    fastcgi_index index.php;
    try_files $uri =404;

    fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    }
    }

    server {
    listen 80;

    server_name ~^(?<project>.*)\.dev$;
    root /Users/robert/Sites/$project/Web;

    client_max_body_size 50M;

    index index.php;

    location ~ /\. {
    deny all;
    access_log off;
    log_not_found off;
    }

    try_files $uri $uri/ /index.php?$args;

    location ~ \.php$ {
    include fastcgi_params;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;

    fastcgi_param FLOW_CONTEXT Development;
    fastcgi_param FLOW_REWRITEURLS 1;

    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    }

    location ~ "^/_Resources/Persistent/" {
    rewrite "(.{40})/.+\.(.+)" /_Resources/Persistent/$1.$2 break;
    rewrite "([a-z0-9]+/(.+/)?[a-f0-9]{40})/.+\.(.+)" /_Resources/Persistent/$1.$2 break;
    }

    location / {
    try_files $uri $uri/ /index.php?$args;
    }

    location ~* \.(jpg|jpeg|gif|css|png|js|ico)$ {
    access_log off;
    expires max;
    }

    }

    server {
    listen 80;

    server_name ~^(?<project>.*)\.prod$;
    root /Users/robert/Sites/$project/Web;

    client_max_body_size 50M;

    index index.php;

    location ~ /\. {
    deny all;
    access_log off;
    log_not_found off;
    }

    try_files $uri $uri/ /index.php?$args;

    location ~ \.php$ {
    include fastcgi_params;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;

    fastcgi_param FLOW_CONTEXT Production;
    fastcgi_param FLOW_REWRITEURLS 1;

    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    }

    location ~ "^/_Resources/Persistent/" {
    rewrite "(.{40})/.+\.(.+)" /_Resources/Persistent/$1.$2 break;
    rewrite "([a-z0-9]+/(.+/)?[a-f0-9]{40})/.+\.(.+)" /_Resources/Persistent/$1.$2 break;
    }

    location / {
    try_files $uri $uri/ /index.php?$args;
    }

    location ~* \.(jpg|jpeg|gif|css|png|js|ico)$ {
    access_log off;
    expires max;
    }

    }

    server {
    listen 80;

    server_name ~^(?<project>.*)\.l$;
    root /Users/robert/Sites/$project;

    client_max_body_size 50M;

    index index.php;

    location ~ /\. {
    deny all;
    access_log off;
    log_not_found off;
    }

    try_files $uri $uri/ /index.php?$args;

    location ~ \.php$ {
    include fastcgi_params;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;

    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    }

    location / {
    try_files $uri $uri/ /index.php?$args;
    }

    location ~* \.(jpg|jpeg|gif|css|png|js|ico)$ {
    access_log off;
    expires max;
    }

    }


    }