Hello,
I am building an app using NextJS (react) which is basically the frontend of it.
Now for the backend I would live to use PHP (such as laravel) for an API that I can call from my NextJS app.
However I always found it quite complicated to setup. What I would use before is Linode for hosting and nginx. It would be complicated because I need to setup some reverse proxies so my NextJS app can be served properly and also the API for laravel needs adding to nginx. I would then always run into issue such as CORS.
Can anyone advice an alternative setup that doesnt use nginx? Like can I deploy my laravel app somewhere?
Any other potential setups for my project that use NextJS as the frontend and PHP as backend?
If your NextJS app can be built completely static, then just serve it up as a static asset from your Laravel app. No CORS to bother with, no extra server to proxy.
If you want to ditch the webserver setup, you could try hosting your Laravel app on AWS Lambda with Bref, but I wouldn’t exactly call that simpler. nginx is pretty easy to set up as a proxy, but if you want something easier, maybe check out Caddy.
Also get to learn Docker and docker-compose especially. Much easier in the long run than setting up servers by hand.
If I use the way I usually do to build projects, then there is always this options request before the real request. That will slow down the website right? So how do all other websites get past this?
Members
Online