Skip to content

Instantly share code, notes, and snippets.

@fernandoperigolo
Created November 1, 2016 19:20
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 fernandoperigolo/f68897c5ef2456159689c23f174fa7fa to your computer and use it in GitHub Desktop.
Save fernandoperigolo/f68897c5ef2456159689c23f174fa7fa to your computer and use it in GitHub Desktop.
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