Skip to content

Instantly share code, notes, and snippets.

@arzola
Last active September 28, 2017 20:13
Show Gist options
  • Save arzola/90514c6b9d89aba6551419c60fde988d to your computer and use it in GitHub Desktop.
Save arzola/90514c6b9d89aba6551419c60fde988d to your computer and use it in GitHub Desktop.
server{
listen 80 default_server;
server_name 10.1.17.116;
root /Users/arzola/Sites/multiple;
location /{
return 410; #Default root does not exists
}
if (!-d $request_filename){
rewrite ^/(.+)/$ /$1 permanent;
}
location ^~ /project1 {
index index.php index.html;
alias /Users/arzola/Sites/multiple/project1/public;
try_files $uri $uri/ @project1;
location ~* \.php{
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include fastcgi_params;
}
}
location @project1 {
rewrite ^/project1/(.*)$ /project1/index.php last;
}
location ^~ /project2 {
index index.php index.html;
alias /Users/arzola/Sites/multiple/project2/public;
try_files $uri $uri/ @project2;
location ~* \.php{
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include fastcgi_params;
}
}
location @project2 {
rewrite ^/project2/(.*)$ /project2/index.php last;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
location ~* /(.git|cache|bin|logs|backups|tests)/.*$ { return 403; }
location ~* /(system|vendor|config)/.*\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
location ~* /user/.*\.(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
location ~ /(LICENSE.txt|composer.lock|composer.json|nginx.conf|web.config|htaccess.txt|\.htaccess) { return 403; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment