how do i run a nodejs app on my apache server? - node.js

I will be straight to the point, I have 0 understanding of nodeJS.
I built an application in codeigniter, and I then purchased a codeigniter chat script. The chat script works, however it uses nodeJS and sockets to get real time updates.
I enabled Node in easy apache 4, but have no clue what to do next. It says i need to run node server.js
so i typed that in SSH but it says command not found.
I really don't understand anything! Any help is appreciated

Related

Docker vs node.js

I'm fairly new to React-native. Im sorry about quite a convoluted question but I have dilemma. I am building an API that communicates with a server app that Im working on, I have been using Docker successfully to run containers BUT I'm constantly being told that I don't need to run Docker at all. I understand the principles of Docker and Node.JS but in all honesty I cant imagine how I would run server side without Docker. Ive tried Node.js and seemed to require a PHP server, which I was also told I did not need. Is this true? which is better Docker or Node.JS? and If Node JS is better how to run it without a php server as it is my understanding that php serves the pages and React consumes the pages.
'You can just install Node, frequently through your OS's package manager. It doesn't require PHP or other language interpreters. I find working directly with Node much easier than using Node in Docker: it is actually a local development environment that my IDE is comfortable with, and not a path to run a Node interpreter "somewhere else" that's isolated from my desktop tooling. '
1)After a few weeks of research I found that I didn't need docker at all. Within Node is the ability to run a server using either fastify or express. I just needed to check on the relevant documentation for usage
2) I linked fastify to ngrok and exposed my local IP address to a public facing direction
3) I linked the ngrock url to my freedns and voila! it worked!
4) I had a small problem with the port which was resolved by using
the command ngrok http 127.0.0.1:5000

Test node.js file from website

I am completely a beginner in node.js and have no idea about its architecture.
I was just going through a tutorial where I have create a sample test node.js file (myapp.js) on my Godaddy server which listens to port 3000.
I have already installed nodejs on the server but not able to test it. I have tried by entering the but that does not work. Can anyone please guide me.
mywebsite.com:3000

Unable to run Node.js app on MAMP/NGINX

I have a Node.js app (my first, so I'm a little inexperienced in this regard) that I'm trying to run locally via MAMP with NGINX, but I'm getting a "403 Forbidden" error (I'm not using Apache as the app's .conf file was written for NGINX).
What I'm unsure about is how to put the app's .conf file into effect. Currently, it's in /env-setup/nginx-setup/, but I'm not sure if it's being executed, or if I have to inser it into /Applications/MAMP/conf/nginx/nginx.conf. Also, when I ls -l the app folder, I get drwxr-xr-x.
Any help would be appreciated. Thanks!
You may want to peruse this guide starting on or around the heading Doing Something Useful - HTTP Server and/or this guide starting at where that link takes you.
Short story, that's correct, nodejs doesn't rely on another server like php does. It runs in its own process, and is responsible for managing incoming connections and listening for them.

how to run node.js on browser via linux apache server?

I installed node.js on linux server. I'm able to run node.js on command line, but not able to run on browser.
Did I clearly explained what I want?
I have a domain ram.com that point to particular location on my server /var/www/html/ram.com/.
I created node.js pages on this location /var/www/html/ram.com .How can I access this page on browser?
My apache running on 80 port. Can you explain any changes in apache configuration?
I'm new to node.js can you explain clearly.
To use Node.js to serve your website, you just need to type node yourFileName.js in command line to start the server.
I don't really know how your pages look like. You need *.js files as Node.js source files, and Node.js work as backend. If you mean *.html, you can access them when the server program is running.
Actually, Node.js has its own built-in web server, just like PHP + Apache. So you don't need to use Apache, and I don't think Node.js and apache can work together without other tools.
This is my first answer in Stack Overflow, hope that can help you.

Register, login, logout Website with Node

I'm currently moving on with reading about node. I'm getting through the tutorials well using the command line. However I am thinking ahead and I want to create a simple register, log in and log out website.
Where would I place the node files on a server (all examples I see run from local host:3000)?
What is the best tutorial for creating this type of website from scratch with node?
Thanks in advance!
It doesn't really matter where you put the files on the server. The localhost:3000 bit comes from the fact that your core server file tells the server to listen on that port.
I would recommend using the express-generator from npm. It's pretty versatile and does a lot of the leg work.
Just run the following:
npm install express-generator
After installing, you'll need to just run the following to create a new web app:
express
The details are here: http://expressjs.com/starter/generator.html.
Also, try to read through and understand all of the pre-provided code.

Resources