Skip to content

Instantly share code, notes, and snippets.

@abulte
Created November 26, 2012 11:51
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 abulte/4147841 to your computer and use it in GitHub Desktop.
Save abulte/4147841 to your computer and use it in GitHub Desktop.
nginx vhost php
server {
listen 80; ## you can put ip’s or localhost here. Or change the port.
server_name benchmark.maboiteprivee.fr;
server_name_in_redirect off;
access_log /var/log/nginx/benchmark.access.log;
error_log /var/log/nginx/benchmark.error.log;
index index.php index.html index.htm default.html default.htm;
root /var/www/benchmark;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.php
if (-f $request_filename) {
expires 30d;
break;
}
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
location ~ .*\.php$
{
include /etc/nginx/fastcgi_params; ##Includes our fastcgi setup
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment