how to install a node.js server at chat.mydomain.com on a hostgator vps hosting? - linux

I have a hostgator VPS hosting account.
I already have a site at my main domain, say mydomain.com
now i want to install node.js server for chat.mydomain.com.
i need some help installing the node.js server.
what i m looking for is, How to setup the node.js server? - I can download and install the node v 0.4.6 but how to make it listen to a port say chat.mydomain.com:8088 like apache? That is install the "node" as a service and listen to port 8088 like apache listens to port 80?
Thanks,
Anjan

All you need to is to open up a port to listen to requests e.g. if you want to run Node on 8088 and then access it with chat.mydomain.com.
According to their support, you need to contact them to open up 8088 for you > http://support.hostgator.com/articles/pre-sales-policies/open-new-ports

Related

What is the easiest way to configure Nginx alone to serve multi-app on different ports

I have centOS 7 server that has a Wordpress site and nodeJs application, I intend to serve these both on port 80 such as using only Nginx, Where nodejs running on port 3000, and how to configure Nginx to accomplish this task

Nginx Proxy Manager (Docker) + mail server

im having a server running ubuntu with docker.
I have a docker instance running Nginx Proxy Manager to serve my multiple domains.
I want to run a mail server but since Nginx is using port 443 for HTTPS and 80 for HTTP i cant install any docker image's since they make use of both 80 and 443.
Example https://poste.io/doc/getting-started#download its also make use of the same ports.
Any idea how to have a single IP and host both web and mail?

How to bind port 4200 (Angular web server) to port 80 (Apache web server)?

I have Apache Web Server running on EC2 (RHEL 7) on port 80.
Also have Angular App running on port 4200 on the same server.
How to bind port 80 so that when someone from outside goes to IP (e.g. 1.2.3.4) goes directly to Apache port 80 (that part works now) which then redirect (or bind) to port 4200 so that the end user can see Angular app output (instead of Apache output)?
Thanks.
Use a reverse proxy Nginx for example.
The step will be the following: Nginx listens 80 port from outside and passes this request to 4200 to your Angular app.
Why do you use apache on this port? And what does apache do?
You should instead like Red Cricket says follow the docs.
First run ng build prod or whatever build you need.
Then add the .htaccess file with redirect rules into your dist folder and place it wherever your apache will serve the angular app.
For extra details see the link provided by Red Cricket.

How to host a website with database having server as my Laptop for free and which has a https link?

I want to host my website which has a node js server and uses sql from xampp. It works great on my laptop using localhost. I want to host it on internet for free from my laptop. I want a https link which can connect to my laptop.
You can easily do this by using a module of nodejs called localtunnel. Suppose you choose a subdomain popeye assuming it is not taken before and port you are using for localhost is 3000 , then use following command .
$ npm install -g localtunnel
$ lt --port 3000 --subdomain popeye
Then whenever you go to link
http://popeye.localtunnel.me it will server from your computers localhost.
Register domain name. Use a dynamic DNS provider to map your domain name to your current IP.
This can be more or less complex.
Consider some cheap VPS server. On the long run this may be easier and cheaper, than dealing with dynamic DNS.

webserver node.js as non root user

I'm a Linux beginner and have a Linux Ubuntu 12.04 server. I've installed node.js and created a webserver script. That works fine, but it runs as root user.
I know that's not good (root-user & webserver = unsafe).
How can I run the webserver script as an non-root user? Does somebody know a good detailed tutorial or can give me some advice?
You have two options:
Listen on port 80
Run as root, start your app's listen() on port 80 and them immediately drop to non-root. This is what Apache does, for example. Not recommended since it's easy to get this wrong, and lots of other details (writing to log files, initialization required before you can listen, etc.). Not standard practice in node.
Listen on port >=1024*
Run as non-root, listen on a port >= 1024 (say: 8000, or 8080), and have someone else listen on port 80 and relay port 80 traffic to you. That someone else can be:
A load-balancer, NAT, proxy, etc. (Maybe an EC2 load balancer if you're running on EC2, e.g.)
Another http server, say Apache httpd or ngnix.
For an ngnix example, see this: Node.js + Nginx - What now?
you can just run node hello.js

Resources