Answer the question
In order to leave comments, you need to log in
PHP backend & Javascript frontend How to set up NGINX?
The client will be on JS https://ru.nuxtjs.org
And the API will be on PHP on the same server on the same domain.
How to set up NGINX?
By default, as I understand it, it will generate JS pages, and if the JS router requests at:
/api/*
Then, as I understand it, nginx should send the request to php-fpm ?
Or how is it not?
Maybe fpm is not needed? Maybe somehow locally send a JS router to php?
If possible, post examples of nginx configs for such bundles. I want to poke around and figure it out.
Answer the question
In order to leave comments, you need to log in
If I'm not mistaken, then for this you can add a bot to the channel and report the rate through it according to the schedule.
You, in principle, have correctly determined everything yourself, just be sure to add versioning of the API (in the future it may very suddenly be very useful):
Do the front as usual, and direct the paths like
site.tld/api/v1/... to PHP
the usual config that runs php or html.
No super settings needed. There is simply no point.
The page still usually displays the original backend + some kind of backend logic works.
Requests for api, they are on api, nginx seems to be out of business here, the application (backend) analyzes where the request goes.
Well, if the backend is on nodejs and php, then just separate locations or subdomains.
Like two fingers there are configs, ready for your environment, only a psychic will give.
The easiest way is to separate the front and back into different domains/subdomains. Let's say the front is site.ru, the back is api.site.ru
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question