is it ok to deploy 2 applications in a single droplet?

I have two apps, api and frontend, I have uploaded in the same droplet, the frontend app is running on the port 3000 and the api is running on the 8000, my nginx config is:

	# root /var/www/html;
	root /home/testing-client/dist;

	# Add index.php to the list if you are using PHP
	index index.html index.htm index.nginx-debian.html;

	server_name _;

	location / {
		proxy_pass http://localhost:3000;
		 proxy_http_version 1.1;
	        proxy_set_header Upgrade $http_upgrade;
	        proxy_set_header Connection 'upgrade';
	        proxy_set_header Host $host;
	        proxy_cache_bypass $http_upgrade;

	# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		#try_files $uri $uri/ =404;

but in my frontend app throw error to connect with api in localhost:8000

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@enmisac Are you get any success?

the steps that I followed were:

  1. Connect with ssh to my droplet
  2. clone two repos -api with nodejs:
  1. install pm2 and nginx
  2. install packages of my 2 apps
  3. enable firewall with sudo ufw allow ‘Nginx HTTP’
  4. config nginx, I have added two lines:
  • root /home/CompleteTestGit/dist;

location / { proxy_pass http://localhost:3000; # First attempt to serve request as file, then # # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; }

my client app on port 3000 is working but no get data of the api on port 8000

This comment has been deleted