Can't get Flight app working with nginx (works fine with other web servers) #619
-
I have successfully been using my app built on Flight with Apache and with the PHP internal server. However I'm getting a 404 with nginx, not for any of my files but it appears from somewhere within Flight. My nginx works fine with other PHP apps and can run the index.php of my Flight app but as soon as it calls Flight::start(), it gets a 404. It's not clear to me where exactly this is happening. My nginx config does have the recommended settings documented for nginx at https://docs.flightphp.com/install. Any tips on how to track down the source of the problem would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
Just for the heck of it, even if it is the same, can you provide your whole config here so I can look it over? Is this on a fresh install with nginx or are there other domains being served off the same nginx server? |
Beta Was this translation helpful? Give feedback.
-
Actually I just remembered that the techempower benchmark for flight runs under nginx. Here's the config that is working. https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/PHP/flight/deploy/nginx.conf |
Beta Was this translation helpful? Give feedback.
-
The Nginx conf that has worked for me looks like this: https://gist.github.com/Lawrence72/25a8073e9bbda50fe13f81a8eed04528 As long as you are using PHP-FPM this should work. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the replies. I found the problem was due to a slightly wonky temporary setup I have where the root for the server was a couple of folders "further up." The 404 was because it was trying to look for folder/folder/endpoint/index.php but only /index.php works. Once I changed things so that the root of the server was the folder where the index.php was located, everything worked. It won't be like this once this is finally deployed for real. Sorry for the trouble. |
Beta Was this translation helpful? Give feedback.
-
Glad you got it figured out! |
Beta Was this translation helpful? Give feedback.
The Nginx conf that has worked for me looks like this:
https://gist.github.com/Lawrence72/25a8073e9bbda50fe13f81a8eed04528
As long as you are using PHP-FPM this should work.