The nginx configuration under the complete separation of the front and rear ends of the laravel project?

recently there is a project with completely separate front and rear ends, and the approximate requirements are as follows:

Project path
|-php_project
|-pc_front_project
|-wap_front_project

pc page corresponding domain name whj.domain.com nginx root is set to pc_front_project directory
web corresponding domain name m.whj.domain.com nginx root is set to wap_front_project directory
backend project is located under php_project directory

the api path accessed in the front-end project (pc+web) is in a format similar to api/user/1

how do I use nginx to forward dynamic requests that start with api in a request front-end project to the back-end php project for processing?

Mar.11,2021

add

to the front-end nginx configuration file
location /api {
    proxy_set_header x-Real-IP $remote_addr;
    proxy_set_header x-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://;
}

ask the subject, how is the code structure implemented?


it sounds like whj.domain.com,m.whj.domain.com 's / api/ all point to the php_project directory
, so just set a separate root for / api/

.
-sharpwhj.domain.com

server_name whj.domain.com;
root /path/pc_front_project;
location / {
    ...
}
location /api/ {
    root /path/php_project;
    ...
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e3f0e5-42db4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e3f0e5-42db4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?