Requests are not working php laravel

October 8, 2018 909 views
Nginx PHP Ubuntu 18.04

I have served a php laravel application via nginx on Ubuntu 18.04 server. This application was working perfectly on a plesk server. I made it work on digital ocean but the problem is that my apis are not receiving any data in the request. When ever I send a request to an api it has a null value in the variable $request of type Request. It is working on a shared server on plesk but not on digital ocean. What can be the problem. Thanks.

2 Answers
unixynet October 8, 2018
Accepted Answer

Can you copy/paste your fastcgi_param variables/values here? In particular, this variable:

fastcgi_param  QUERY_STRING 

Also, copy/paste what you have in your try_files.

  • Here are the values in fastcgi_param file

    fastcgiparam QUERYSTRING $querystring;
    fastcgiparam REQUESTMETHOD $requestmethod;
    fastcgiparam CONTENTTYPE $contenttype;
    fastcgiparam CONTENTLENGTH $contentlength;

    fastcgiparam SCRIPTNAME $fastcgiscriptname;
    fastcgiparam REQUESTURI $requesturi;
    fastcgiparam DOCUMENTURI $documenturi;
    fastcgiparam DOCUMENTROOT $documentroot;
    fastcgiparam SERVERPROTOCOL $serverprotocol;
    fastcgiparam REQUESTSCHEME $scheme;
    fastcgiparam HTTPS $https ifnot_empty;

    fastcgiparam GATEWAYINTERFACE CGI/1.1;
    fastcgiparam SERVERSOFTWARE nginx/$nginx_version;

    fastcgiparam REMOTEADDR $remoteaddr;
    fastcgiparam REMOTEPORT $remoteport;
    fastcgiparam SERVERADDR $serveraddr;
    fastcgiparam SERVERPORT $serverport;
    fastcgiparam SERVERNAME $server_name;

    PHP only, required if PHP was built with –enable-force-cgi-redirect
    fastcgiparam REDIRECTSTATUS 200;

    And here is the try_files

    tryfiles $uri $uri/ /index.php?querystring;

  • waiting for your response.

Have another answer? Share your knowledge.