php - nginx configuration for a RESTful API -


I'm starting with nginx and php, so please excuse my basic question.

A happy-based API (nginx + PHP) I'll need some help with nginx configuration

All / api / v1 / * requests on my apiv1.php script Here is the related snippet for nginx configuration (as suggested) to redirect:

  server {server_name} MYSERVER; Root / usr / share / nginx / html; Location / API / V1 / {trail_files $ Yuri $ Yury / / APIPPP } Place ~ \ .php $ {include fastcgi_params; Fastcgi_pass Unix: /var/run/php5-fpm.sock; }  

The problem now is that when I type in my browser, the apiv1.php script does not get "Resource / GetInfo". Actually, _GET and _REQUEST are empty, but _SERVER looks OK!

In my /etc/php5/fpm/php.ini, the following relevant configs are enabled:

  request_order = "GP" variables_order = "GPCS" register_argc_argv = Off Auto_globals_jit = ON  

Do you know why PHP _GET and _REQUEST are empty? Is it related to my php configuration?

Best regards, M.

Change this:

  space / API / V1 / { Try_files $ uri $ uri / /apiv1.php?$args; }  

with your following in the server block:

  rewrite ^ / api / v1 / ([^ /] +) / ([^ /] +) /? $ /apiv1.php?class=$1&method=$2? last; Create a php file named  

apiv1.php and place it in the root directory of your web server with the following lines of code:

   

Test your browser by visiting the following link:

  http: // myServer / api / v1 / members / getInfo   

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -