Redirecting between apache / nginx

Software used in the web hosting industry. Topics include control panels, add-on software, setup scripts, etc.
Post Reply
edward
Newbie
Posts: 2
Joined: Sun Oct 08, 2017 11:25 am

Sun Oct 08, 2017 11:30 am

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: Select all

 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  :)


User avatar
edwin
Junior Member
Posts: 18
Joined: Thu Sep 28, 2017 6:17 pm

Sun Oct 08, 2017 4:46 pm

Hello,

The shape of your URL is a bit "special" you would have had:

Code: Select all

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: Select all

location / {
         # try to serve file directly, fallback to app.php 
        try_files $ uri /api.php$is_args$args; 
    }
Source:

Code: Select all

https://www.nginx.com/resources/wiki/start/topics/recipes/symfony/
regards :)
edward
Newbie
Posts: 2
Joined: Sun Oct 08, 2017 11:25 am

Sun Oct 08, 2017 5:03 pm

problem is solved, thanks :)
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 0 guests