0

Well, I want to deploy the react-boilerplate project to my digital ocean vps server. Command npm run start:production runs the application by address http://XXX.XXX.XXX.XXX:3000/.

I'm going to run the server without port like http://XXX.XXX.XXX.XXX or http://my-domain.com.

How can I set port or domain for production mode?

Smart Solutions
  • 869
  • 2
  • 10
  • 30

3 Answers3

2

Generally you will run your node app on localhost at port 3000. Then you would use nginx as a proxy to receive connections on port 80/443 and forward them to your server running on port 3000. Here are some notes that describe some of the configuration needed for this:

https://github.com/jensen/deployment-notes#nginx

jens
  • 2,075
  • 10
  • 15
1

Try using PORT=80 npm run start:production if you will use http or PORT=443 npm run start:production if you will use https. That should make your app accessible without a port on digital ocean.

Gleb Kostyunin
  • 3,743
  • 2
  • 19
  • 36
0

I would suggest, Serve build file using file server.

https://www.digitalocean.com/community/questions/how-do-i-put-up-a-simple-static-website