Skip to content

Instantly share code, notes, and snippets.

@slywalker
Last active December 10, 2015 20:58
Show Gist options
  • Save slywalker/4491763 to your computer and use it in GitHub Desktop.
Save slywalker/4491763 to your computer and use it in GitHub Desktop.
nginx conf
server {
listen 80;
server_name ~^(.*)\.cakephp\.dev$;
set $_document_root /opt/local/var/www/cakephp/$1/webroot;
set $_server_name $1.cakephp.dev;
# if directory doesn't exist
if (!-e $_document_root) {
rewrite ^ http://localhost last;
}
# Sets the correct root
root $_document_root;
index index.php index.html index.htm;
client_max_body_size 20m;
client_body_buffer_size 128k;
access_log off;
try_files $uri $uri/ /index.php?$args;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
fastcgi_param SERVER_NAME $_server_name;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
}
server {
listen 80;
server_name ~^(.*)\.local\.dev$;
set $_document_root /opt/local/var/www/$1;
set $_server_name $1.local.dev;
# if directory doesn't exist
if (!-e $_document_root) {
rewrite ^ http://localhost last;
}
# Sets the correct root
root $_document_root;
index index.php index.html index.htm;
client_max_body_size 20m;
client_body_buffer_size 128k;
access_log off;
try_files $uri $uri/ /index.php?$args;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
fastcgi_param SERVER_NAME $_server_name;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment