Skip to content

Instantly share code, notes, and snippets.

@zacharyblank
Created November 18, 2014 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zacharyblank/8aab2233735351327b7a to your computer and use it in GitHub Desktop.
Save zacharyblank/8aab2233735351327b7a to your computer and use it in GitHub Desktop.
# Remove /v1/ from the request uri
map $request_uri $post_uri {
~^/v1(?P<uri_string>.*)$ $uri_string;
}
# Main Host
server {
listen 80;
server_name host;
# Set Logs based on API version
error_log /var/log/nginx/error.log debug;
access_log /var/log/nginx/access.log;
root /vagrant/api/v1/public;
if ($request_uri ~* ^/v1) {
rewrite ^/(.*)$ /$1 last;
}
location / {
try_files $uri /index.php?$query_string;
}
server_tokens off;
client_max_body_size 20m;
client_body_buffer_size 128k;
fastcgi_intercept_errors off;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_param REQUEST_URI $post_uri;
fastcgi_param ENVIRONMENT development;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment