I’ve been trying to deploy a react app, was messing around for a while until I realized you have to build it on the component settings, but I also want to build a PHP server to manage some queries, when I do it on my machine I open a terminal and run PHP -S localhost:8000
them I head back to the root folder and run npm run build
and it works.
Tried the same workflow on the DigitalOcean panel but it’s just building the app without the server
I know I’m probably missing something in the workflow but what I have in the commands tab is
cd PHP/
PHP -S localhost:8000
cd -
npm run build
is there any way to run both commands at the same time and how do I know on which port is the build running?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Hi @juanpabloshark,
You can use Nginx which would be listening on port 80 and 443 and configure reverse proxy for the app that needs port 8000.
Basically, you’ll need to configure two separate configuration files for your two applications. Here is a tutorial on how to deploy an NodeJS application with Nginx as a reverse proxy:
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-20-04
Additionally, you’ll need to configure your PHP app as well, you can follow this tutorial :
https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04#step-5-setting-up-server-blocks-recommended