Welcome to Web Hosting Forum - Net Hosting Talk

Register now and be part of our community! When you register with the Net Hosting Talk you can join in with topics, start new topics, and generally be a part of the first level of our community. It's also quick and totally free, so what are you waiting for?

Redirecting between apache / nginx

Hello,

I am trying to dev api in php, the url is for example http://127.0.0.1/api.php / search = debug on my first machine that is under apache and it works. On the other hand, on another one that uses nginx, it does not work, in error.log I have an error like what the file is not a folder ..
Code:
 2017 /10/ 8  10 : 08: 23 [error] 2717 # 2717: * 141605 open () "/var/www/api.php/search=debug" failed (20: Not a directory), client: 192.168.15.64 , server:, request: "GET /api.php/search=debug HTTP / 1.1", host: "127.0.0.1"

I think the problem is either with nginx or php-frm, but I do not see how the fix, please share if you have an idea ... 

Thanks  :)
 

edwin

Moderator
Messages
40
Reaction score
3
Hello,

The shape of your URL is a bit "special" you would have had:
Code:
api.php? search = debug

I think it would have less shocked Nginx. It is probably in the nginx.conf that we must find the solution because it tells you that it did not find a directory "search = debug"

Try to add this (part of the configuration for Symfony) in the file nginx.conf for the site in question:
Code:
location / {
         # try to serve file directly, fallback to app.php 
        try_files $ uri /api.php$is_args$args; 
    }

Source:
Code:
https://www.nginx.com/resources/wiki/start/topics/recipes/symfony/

regards :)
 

Advertisement

Top