NGINX and Lumen (Laravel) 5

Reinis Rozitis r at
Wed Jul 27 19:42:32 UTC 2016

> Will consider it, but as menitoned above, making laravel "the" site is not 
> appropriate for my context.

Because of how nginx locations work (only one gets chosen for a request) 
running several applications under one virtualserver/domain can sometimes be 

Also because the laravel/lumen applications do have their 'public' as second 
level folder means if you put the whole application into existing root all 
the "non-public" (upper-level) folders get somewhat exposed.

If the Lumen app is outside the default root you could try something like 

location ^~ /lumen {
    alias /usr/share/path/to/my/lumen/public;
    try_files $uri $uri/ /lumen/index.php?$query_string;

location ~ \.php$ {
     fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
     fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
     fastcgi_index index.php;
     include fastcgi_params;

There is an extra nested location .php {} within the /lumen location since 
if you have a global *.php block the request won't have the alias directive 


More information about the nginx mailing list