Skip to content

Instantly share code, notes, and snippets.

@michaelhoang
Last active August 29, 2015 14:09
Show Gist options
  • Save michaelhoang/cd6e3ca5eded981c6c55 to your computer and use it in GitHub Desktop.
Save michaelhoang/cd6e3ca5eded981c6c55 to your computer and use it in GitHub Desktop.
Vhost in Nginx
#Add new vhost in Nginx
server {
listen *:80;
server_name example.local www.example.local;
index index.html index.htm index.php;
access_log /var/log/nginx/example.local.access.log;
error_log /var/log/nginx/example.local.error.log;
location / {
root /var/www/example;
try_files $uri $uri/ index.php /index.php$is_args$args;
}
location ~ \.php$ {
root /var/www/example;
index index.html index.htm index.php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
}
sendfile off;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment