NGINX and Lumen (Laravel) 5

Reinis Rozitis r at roze.lv
Wed Jul 27 16:39:43 UTC 2016


> It exists all the way up to /public/, but NGINX seems to be adding the 
> /lumen/ bit, which I guess is because of "location /lumen", but I'm not 
> too sure how to go about telling it not to add the the location path as a 
> suffix.

You could try to use the alias instead of root then ( 
http://nginx.org/en/docs/http/ngx_http_core_module.html#alias ).


In my mind though you're making it complicated.

In my experience all the Laravels work just simply by doing:

server {

   root   /path/laravel/public;

   location / {
           try_files $uri $uri/ /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;
   }
}

All the non-existing files (it helps to define a seperate location for 
static files though) and virtual paths are passed to the Laravel's 
/index.php "router" and it knows what to do with it without any extra 
mumbojumbo on nginx side.

rr 



More information about the nginx mailing list