nginx configuration for a RESTful API

后端 未结 2 1644
走了就别回头了
走了就别回头了 2021-02-08 06:34

I am a beginner with nginx and php, so please excuse my basic question.

For a RESTful based API (nginx + php) I would need some help with nginx configuration.

H

2条回答
  •  悲哀的现实
    2021-02-08 06:50

    If someone else hit this page, there is solution I got for myself after a bit research:

    location ~ ^/api/v0/(.*)/?$ {
        try_files $uri $uri/ /v0.php?req=$1&$args;
    }
    

    Here I'm not limited with class/method structure and location seems more readable than rewrite.

提交回复
热议问题