NGINX and Lumen (Laravel) 5

Francis Daly francis at daoine.org
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: 192.168.121.10, server:
> my.example.com, request: "POST /lumen/ HTTP/1.1", host:
> "my.example.com"

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 "site:laravel.com nginx" or
"site:nginx.com laravel" or "site:nginx.org laravel" return useful docs?

Cheers,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list