Skip to content

Instantly share code, notes, and snippets.

@svallory
Last active February 20, 2018 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save svallory/3fd9845a0081741c5c1e93ad923799ec to your computer and use it in GitHub Desktop.
Save svallory/3fd9845a0081741c5c1e93ad923799ec to your computer and use it in GitHub Desktop.
Nginx Wildcard config
server {
listen 80;
server_name ~^(www\.)?(?<project>.+?).dev$;
root /projects/$project;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.html /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log /var/log/nginx/$project-access.log;
error_log /var/log/nginx/new-error.log debug;
error_page 404 /index.php;
sendfile off;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment