19
linuxxx
6y

Any NGINX experts here? I'm completely stuck, just can't figure this one out.

Config stuff.

Comments
  • 3
    Certainly not an expert, but I know my way around quite well, maybe I can help.
    What's your issue?
  • 2
    @kolaente I finally managed to get the general config working so I can reach the api endpoints now but although I'm getting http status codes from php, not getting any other data from it, all responses are empty and I'm very sure that content/data is being generated.
  • 2
    @linuxxx are you reading response with PHP? Be sure to use php://input, something like: $data = json_decode( file_get_contents( 'php://input' ), true );
  • 2
    @fonfi Oh no as in the output isn't coming out, the response is empty except for the http status.
  • 2
    add / check access log / error log
    curl -v the url
    if you have the fastcgi google is your friend
    https://serverfault.com/questions/...
  • 2
    @vane I'm error debugging on debug level already :/

    I can try curl, good one.
  • 2
    @linuxxx Are you using fastcgi? Via port or socket? Is it running? Is it properly configured to listen on the same way nginx calls it?

    Also, is your nginx config able to serve simple static files? If not, maybe something is wrong with the nginx config itself.
  • 1
    Really need more info here.
    How does your vhost look like?
    php-fpm or not? Reverse proxy or not? What’s the project root that you expect?
    What’s the status code? Any cors header errors?
    Only access log is showing traffic?
  • 1
    @kolaente
    - Using php fpm
    - via socket
    - yeah its running
    - Not entirely sure what you mean but I'm very sure that its passing stuff correctly since I'm getting correct http status codes from php.
    - yes, its running 20+ websites and they all work well with php.

    @mpie
    - I can't just share that too badly
    - php fpm
    - no reverse proxy
    - what do you mean?
    - status code depends on what I'm requesting but I'm getting the right status code every time (this can vary and I know from tests that I'm getting the correct ones)
    - no cors errors
    - yes, access log is showing requests.
  • 1
    Is it Nginx running on DirectAdmin?
  • 1
    @linuxxx maybe you got
    return 200 ‘’; somewhere 😂
  • 1
    @linuxxx does the location in your vhost match and goes to the correct folder is what I meant.
    Does static file location work?
  • 1
    @linuxxx Does it work when you put another PHP file in the exact location you want to access with just a "phpinfo();"?
  • 1
    @linuxxx how are you forwarding your requests to php? Are you sure those response code are from php or just nginx telling you what happened with it?
  • 0
    After tons of debugging I discovered that curl is showing response and my browsers show it as well but ONLY if I echo something before the response (a number or whatever).

    I have no clue why.
  • 0
    @linuxxx what does curl -I return?
  • 0
    @kolaente Fixed it, thanks for all the help!
  • 0
    @linuxxx you're a celebrity here man

    linuxxx: can someone help me with something?
    people: YES AND HERE'S 20 UPVOTES!

    it's heartwarming
  • 0
    Share config
  • 1
    @erandria Hope I warmed your heart then.
Add Comment