Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use this NGINX server conf to run more than one Magento instalation on server. You can access based on folder. Works copy and past if you created a machine using puphpet.com
server {
listen *:80;
server_name awesome.dev;
client_max_body_size 30m;
set $basepath "/var/www";
set $domain $host;
if ($domain ~ "^(.*)\.awesome\.dev$") {
set $project $1;
}
set $rootpath "${domain}";
if (-d $basepath/$project/web) {
set $rootpath "${project}/web";
}
root $basepath/$rootpath;
index index.html index.htm index.php;
access_log /var/www/access.log;
error_log /var/www/error.log;
location ~ \.php$ {
set $path_info $fastcgi_path_info;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
try_files $uri $uri/ /index.php$is_args$args;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param APP_ENV dev;
}
location / {
root $basepath/$rootpath;
try_files $uri $uri/ /index.php$is_args$args;
autoindex off;
index index.html index.htm index.php;
}
sendfile off;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment