Actually there is a server on it configured by apache + php and separately spinning on nodejs nuxt, there was a question how to tie them together. NUXT is responsible for front-end and php for backend and working with mysql.

Offloaded NUXT ports to port 80, and php responds to 8090.

Now the question is to execute a query to php to upload files to the server and receive data from the database. Because I address on a link / api naturally node does not know what is php and does not fulfill.

According to the structure:

/var/www/html /var/www/node 

In this situation, it has come only in the variant to perform a cross-request, but then it is necessary to give rights with html to fill files in the node that are loaded by the client.

I will be glad to hear any solutions to this problem. Up to the backend census. Then the question is what to use for uploading photos, js to mysql is a plugin, I don’t want to send requests to the client in code.

Thanks to everyone who read :)

  • If you use Nodejs only to give html, then it is logical that requests for backups should be sent directly to the back - Dmytryk
  • Node is used for SSR on nuxt which increases both the speed of loading pages and eliminates the transfer of excess. - Ruslan Semenov
  • From your comment, it is not quite clear what prevents you from making a request directly to the php server - Dmytryk
  • Probably poorly explained, if I address as / api then there is no such folder, if you create it then php does not work in it. You have to contact port 8090 and then it’s like a cross-request, it is determined by the browser like on another site. I’m looking for options on how to do without them, I found an article with a proxy under nuxt, but I haven’t reached my head yet. I am looking for options. - Ruslan Semenov
  • And apache cannot redirect requests to / api to port 8090? - Dmytryk

0