Unable to run Node.js app on MAMP/NGINX - node.js

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.

Related

how do i run a nodejs app on my apache server?

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

Node.js and ColdFusion on the same server?

I have question about how to set Node.js server application. On my server I have ColdFusion application server. I can test my code through browser url. I would like the same for Node.js. Node is already installed on my server but the only way to run the code is through cmd command window. First question is what I need in order for both to run on the same server? I still need my ColdFusion. Second question is about Nodes.js and can I set up server application with ISS or I need something else? Also do I have to specify what extension on my files will point to ColdFusion and other to Node. For example .cfm extension is for ColdFusion and .js is for the Node. If anyone knows anything about this or where I can find more information please let me know. I never experienced something similar and this is something completely new for me.
I know this is an old post but I figure I'd provide an answer for those souls who are looking around.
If working with Apache 2.4.x.
In a test environment this would not be to much of an issue as Node and Coldfusion operate on different ports.
If your looking to create a production site than I would say that building a virtual host with proxy to the node site and Coldfusion would be another method.
If you are using the Coldfusion connector to Apache and loading node, than still loading the proxy for the node part would be fine, just make sure you are pointing to the correct port for your node.
Things to remember:
You may have to alter internal Firewall rules.
Comment your hosts files so you don't accidentally alter the wrong file.
Both can exist within the same platform.

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.

Running UI5 on Node JS server

I'm trying to run my ui5 pages on Node.js server. What I've done till now is created a UI5 project with a simple index.html file calling my other ui5 views showing a text message. When I run it without node js it runs fine and shows me the message.
What I'm trying to achieve now is run this on top of my node server. So I've configured a server.js file for my node and it starts up fine. In there I'm calling up my above index.html file. it calls it fine but it gives an error inside it saying sap is undefined meaning it is not able to find my ui5 resources like sap-ui-core.js and thus the error. I'm not sure why it is not able to find it.
I've created the ui5 project using eclipse which provides me the ui5 resources under the below directory but even if I try to put the resources directory under the web content directory it is not able to find it.
After manually putting resources directory:
Below is how my index.html looks like:
Has it got something to do with the resource root that I define or please if you can suggest how can I get it working.
Awaiting your responses eagerly.
Thanks,
AW
Adding to cschuff response:
Hello, thanks for taking time to help me out. Yes my apps namespace is different and definitely not something with sap.ui. Though I've got a way around of getting it to work but still would like to get this to work as well as it is much cleaner. The way I've got it working now is by creating a seperate node project altogether and then gradually adding my UI5 pieces to it and by gods grace it is running fine now. But I'm not sure why the same concept if I apply on a UI5 project created in eclipse, it gives me sap is undefined error.
My only suggestion that you misconfigured node.js server. Try start from scratch:
mkdir app
cd app
npm install -g express-generator
express -f
npm install
node .\bin\www
Than put all of your files of your project and resource in public directory. And try to open http://localhost:3000/index.html
The /resources are delivered by the com.sap.ui5.resource.ResourceServlet (see your web.xml; web.xml and Servlets are used in the Java World e.g. by Java Application Servers or Servlet Containers like Tomcat)
The ResourceServlet listens on the url-pattern /resources/* meaning every time a request is send to an url matching this pattern the ResourceServlet (a Java class) will step in, look up the right .jar file and return the required JavaScript file from it. This won't work with a plain web server like Apache.
I don't know much about express but I guess it is not able to run Java Servlets and thus is not able to deliver your SAPUI5 resources the same way Tomcat does.
To work around this you still have some options:
Use Express to serve your application sources and load UI5 from Tomcat while developing. This might lead to cross-origin problems (since localhost:8080 and localhost:3000 are considered different origins)
<script src="http://locahost:8080/resources/sap-ui-core.js" ...
Unpack all the UI5 .jars you need and place them in YourApplication/resources/.
BR
Chris

Running vline-node example on IIS

I have successfully tested the vline-node example locally, but would like to push it out to a server. I have tried to install the example as an application on an IIS8 website, placing the example code under wwwroot. I have done tried this both within the root and inside a virtual directory, pointing to the views folder. I am able to login to the application from a browser on the server, although, since javascript is turned off on the server browsers for security, so functionality is missing.
However, when I try to access the site from a remote browser I am not able to login. Actually, I can see that there is something wrong with my paths, as the include files are not found.
The more I've thought about this the more confused I've become. I'd like to run this under IIS, but wonder if that makes sense. Can someone offer a clean solution for hosting the vline-node example on a Windows Server, ideally under IIS?
Since you are using the node example, you'll need to make sure that node is actually running on your IIS server. Here's a SO response that may be helpful: How to run Node.JS server for a web application?
Note that in our node example the "main" file is vline-node.js, so use that in place of the app.js that is mentioned.

Resources