Skip to content

Instantly share code, notes, and snippets.

@stevepop
Created September 20, 2012 12:14
Show Gist options
  • Save stevepop/3755551 to your computer and use it in GitHub Desktop.
Save stevepop/3755551 to your computer and use it in GitHub Desktop.
Nginx Vhost Config For Frameworks
Since I am using Nginx as a web server, I have included the virtual host configuration below as it took me quite a while to understand Nginx setup and how it handles rewrite rules.
Virtual Site config for the Silex Tutorial
server {
listen 80;
server_name silextut.local;
root /mnt/hostnfs/silextut/web;
index index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
location / {
if (-f $request_filename) {
expires max;
break;
}
rewrite ^(.*) /index.php last;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment