Skip to content

Instantly share code, notes, and snippets.

@igortik
Last active April 6, 2016 18:40
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 igortik/728faaf33637880c757326c6ba7d0cea to your computer and use it in GitHub Desktop.
Save igortik/728faaf33637880c757326c6ba7d0cea to your computer and use it in GitHub Desktop.
Nginx configuration for local web server and multiple apps
server {
listen 80;
server_name ~^(?<app>.+)\.localhost$;
root /Users/user/www/$app/;
index index.html index.php;
location / {
try_files $uri $uri/ /index.php;
}
# set expiration of assets to MAX for caching
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
log_not_found off;
}
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
include /usr/local/etc/nginx/fastcgi.conf;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment