Deploy nodejs express on AWS windows server - node.js

I deplyoed my nodejs application on a AWS server with windows server as OS. The application is a simple express server running on https port 443. The application is accessible through localhost, but I can access the app through public IP.
Here are a few things I tried:
IIS with urlrewrite like so (https://dev.to/massivebrains/deploying-node-express-app-on-a-windows-server-2l5c)
iisnode
I am still not able to access my app. I setup up inbound rules in my firewall for the port and nodejs itself.

The issue was simply in my security group. I had set up the IP addresses I was expecting, but one was missing. It is working now.

Related

Connect domain to nodejs server hosted on vps instead on ip + port

i have 2 react apps and a nodejs server (express and websocket) running on port 8000.
the express server is for generating random links and the websocket for sending real-time messages between the apps.
my apps worked perfectly after hosting on my vps server but after connecting letsencrypt ssl to both react apps, they don't work anymore because i have to connect to a websocket with secure connection.
so i want to connect the nodejs server with a subdomain i have from namecheap.
i have tried pointing the subdomain i got for the server to the ip of the vps but i don't know what to do after that.
should i create a new file just like i did for the previous apps in the sites-available directory, listen to port 8000, set server name to the intended subdomain and run a proxypass to the same subdomain?
This is my first time hosting on a vps server, i'm very confused at the point but my server works well when i just type in ip:8000 on my brower

How to set ssl certificate on aws ec2 instance?

I want to use https (port 443) for my web app which is developed using NodeJS express mongodb.In order to do that I know I need to get ssl certificate. My app is hosted by Amazon ec2. My express server listens port 3000.I created ssl certificate using Amazon Certificate manager ,and I also set up apache following some tutorial. However when I go to port 40 I see apaches page (I used to see my app here since I redirected port 80 to 3000 before). When I do https request it just gives me nothing.I set load balancer and attached to my ec2 instance.Is there a good tutorial or can you tell me what I am missing? This became so annoying.

Nodejs Loopback how to access api end points on live server?

I'm trying to deploy a Loopback project to live server, all works well on local. On server, after running node ., I get the console log of:
Web server listening at: http://domainname:3000
Browse your REST API at http://domainname:3000/explorer
So it looks like the server is running.
Problem is that I get no response from the server. Neither from domain:3000 or /explorer or any endpoint I created.
Does anyone know what might be the issue?
Thank you very much
I had a similar problem when I was trying to deploy my code. Some of the possible solutions to the problem depending on where and how you are deploying it-
Check if your security group allows connections on port 3000. AWS EC2 by default closes all ports except port 80. You might have to add an exception to your security group and allow port 3000 to be accessed from everywhere.
If you are using a container, check if your container has the ports open and if the container port is accessible by the hardware hosting the container. On Azure, I faced this problem as Azure Web App Container Service by default only listens to port 80 and 8080. So I had to modify my code such that it can use the default NODE_ENV.PORT or 8080.

AWS EC2 instance access internal server

In my Amazon EC2 instance I have a Pyramid server as well as a NodeJS server running. The NodeJS server acts as the frontend and I updated my security groups so I can use the public DNS to view the page.
The Pyramid server acts as a backend and the frontend accesses it by http://0.0.0.0:8002/. But when I do an http call to the backend I get a Failed to load resource: net::ERR_ADDRESS_INVALID error message.
Do I need to add a rule to the security groups, or update the iptables, or something?
If both of these services are running on the same server, you shouldn't be sending network traffic out of the server and back, so security groups will not be an issue here.
The question is, why are you using 0.0.0.0 here? I think you probably configured the Pyramid server to listen on 0.0.0.0, which really means "listen on all IP addresses". However you need to be using http://127.0.0.1:8002/ or http://localhost:8002/ in order to connect to the service from another service running on the same server.

Hosting a Web Server and Web Service locally on same port

I seem to miss somehting really obvious.
Anyways, i am developing a ReactJs web app and use nodejs (browser-sync) to host a simple web server for testing on localhost. Everything's working fine.
As for the server side i have a REST Service hosted in ASP.NET WebAPI.
I want to keep the urls in the web app relative for deployment reasons (because then it doesn't matter what the hostname is, as long it's running on the same domain).
I know out of experience that it's possible to host a self hosted ASP.NET WebAPI and a Web Application in IIS Express (at least in different paths) at the same time.
But now when i start browser-sync (which uses node http server internally as far as i can tell) and then WebAPI service host, the service host tells me it can't host on this url.
When i start it the other way around, browser-sync automatically increases the port so that it's on the next free port.
Does somebody have experience with it?
EDIT:
My question maybe in a more general sense: How do you develop web apps that are hosted on a local web server (in my case via nodejs) against a local running web service? And do you use relative URLs in your web app? Which leads to the problem that the service and the web have to run on the same server
I solved my problem like this:
ASP.NET WebAPI hosts under a different port then the nodejs web server
I set up a proxy in nodejs webserver for all urls starting with '/api/' and proxy these requests to the WebAPI port
I can use relative URLs in my client

Resources