NGINX and Lumen (Laravel) 5

Francis Daly francis at
Wed Jul 27 15:07:02 UTC 2016

On Wed, Jul 27, 2016 at 02:43:32PM +0100, Ben wrote:

Hi there,

> At the moment, the best I can get NGINX to give me is 405 errors.

405 is usually "Method Not Allowed", such as when you try to POST to a file.

But in this case, you do your own "return 405".

> Which translates to the following error.log entry :
>  stat()
> "/usr/share/path/to/my/lumen/public/directory/<snip>/public/lumen/"
> failed (13: Permission denied), client:, server:
>, request: "POST /lumen/ HTTP/1.1", host:
> ""

What happens if the nginx user does

ls -l "/usr/share/path/to/my/lumen/public/directory/<snip>/public/lumen/"

? And: does that error.log entry only appear once? I would expect it
twice per request, given your config.

> location /lumen {
> root /usr/share/path/to/my/lumen/public/directory/<snip>/public;
> try_files $uri $uri/ /index.php?$query_string;

So, $uri fails (permission denied), $uri/ fails (permission denied),
so now there is an internal rewrite to /index.php.

> location ~ [^/]\.php(/|$) {
> fastcgi_split_path_info ^(.+?\.php)(/.*)$;
> if (!-f $document_root$fastcgi_script_name) {
>         return 405;
> }

And unless /usr/local/nginx/html/index.php exists, that "return 405"
will happen.

That's why what you have fails today.

Does searching for something like " nginx" or
" laravel" or " laravel" return useful docs?


Francis Daly        francis at

More information about the nginx mailing list