简体   繁体   English

如何通过Linux Apache服务器在浏览器上运行node.js?

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

I installed node.js on linux server . 我在linux server上安装了node.js I'm able to run node.js on command line, but not able to run on browser. 我可以在命令行上运行node.js ,但不能在浏览器上运行。

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/ . 我有一个域ram.com ,它指向我的服务器/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? 我在/var/www/html/ram.com这个位置创建了node.js页面。如何在浏览器中访问此页面?

My apache running on 80 port. 我的apache80端口上运行。 Can you explain any changes in apache configuration? 您能解释一下apache配置的任何变化吗?

I'm new to node.js can you explain clearly. 我是node.js新手,您可以清楚地解释一下。

To use Node.js to serve your website, you just need to type node yourFileName.js in command line to start the server. 要使用Node.js为您的网站提供服务,您只需要在命令行中键入node yourFileName.js即可启动服务器。

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. 您需要*.js文件作为Node.js源文件,而Node.js充当后端。 If you mean *.html , you can access them when the server program is running. 如果您的意思是*.html ,则可以在服务器程序运行时访问它们。

Actually, Node.js has its own built-in web server, just like PHP + Apach e. 实际上, Node.js具有自己的内置Web服务器,就像PHP + Apach e。 So you don't need to use Apache, and I don't think Node.js and apache can work together without other tools. 因此,您无需使用Apache,并且我认为Node.jsapache无需其他工具即可协同工作。

This is my first answer in Stack Overflow, hope that can help you. 这是我在Stack Overflow中的第一个答案,希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM