NGINX and Lumen (Laravel) 5

Ben ben+nginx at list-subs.com
Wed Jul 27 16:27:10 UTC 2016



On 27/07/2016 16:07, Francis Daly wrote:

>
> 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".

POST was just an example, the config doesn't work with GET or anything else.


> What happens if the nginx user does
>
> ls -l "/usr/share/path/to/my/lumen/public/directory/<snip>/public/lumen/"

Doesn't exist.

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

exists, but the /lumen/ suffix doesn't.

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

Only appears once.


>
>> 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.

"/usr/share/path/to/my/lumen/public/directory/<snip>/public/index.php" 
exists 
"/usr/share/path/to/my/lumen/public/directory/<snip>/public/lumen/index.php" 
does not, and that seems to be where NGINX is insistent on going.

.
>
> Does searching for something like "site:laravel.com nginx" or
> "site:nginx.com laravel" or "site:nginx.org laravel" return useful docs?
>

Admittely I didn't try "site:" but I did try "nginx laravel", tried a 
few ideas from various stackexchange discussions but nothing much seemed 
to fix it.  Hence I thought I'd drop by here incase anyone had 
experienced it before and could save me spending another few hours 
looking for the proverbial needle in a haystack (since I bet it will end 
up being a stupidly small NGINX config file change I need to make !).



More information about the nginx mailing list