Problem
GoDaddy last host can hang multiple sites (such as the PHP site), then node. js site can also be used as one of the sites on GoDaddy?
Virtual Host Implementation
To answer this question, we need to first analyze how the virtual host is implemented. Take Apache for example.
In Apache server, the virtual host is supported by Apache itself (can view: https://httpd.apache.org/docs/current/vhosts/), only need to configure the Apache configuration file, You can put multiple sites on the same host.
Can node. js be able to be hosted on a virtual host with other sites?
First of all, we need to know that node. JS is a self-bringing server (this is not the same as PHP, PHP is just a CGI script, running on the server supporting CGI scripts, such as Apache,nginx, etc.). So if you want node. js to run on GoDaddy's virtual host, then you can't use GoDaddy's virtual host server configuration. Even if Nodejs is installed on the virtual host, the new domain name is assigned to the Nodejs folder in Cpanel? However, the code is not running, because this is also how the host server runs CGI scripts, and node. JS is not a CGI script and comes with a server, and obviously cannot be run by the host server. So it's not feasible to put node. js into a virtual host in a straightforward way.
The unorthodox way the node. JS deployment is on a virtual host
What if you have to do a deployment of node. js to a virtual host? There are ways to do it, but it's not orthodox, preferably not.
Method One:
The use of Cgi-node,cgi-node can be like PHP as a CGI script to run, in GoDaddy above the configuration also has a tutorial, but it is not in line with our needs, it is actually a PHP encoding mode of simulation, Using a server that does not use node. JS comes with a framework that may not be available for express. This way of changing the coding is clearly not in our case.
Method Two:
Use the server Proxy. The Apache server itself supports the functions of the agent, can send a specific request link to another link to process, and then return the processing results (reference: http://stackoverflow.com/questions/9831594/ Apache-and-node-js-on-the-same-server). At this point we only need to run node. JS under the virtual host, http://localhost:3000
and then in Apache configure the http://www.example.com/node
start of the link to all agents localhost:3000
, so that we can indirectly let node. JS deployment on the virtual host. But the question is, how do we configure the Apache configuration file for the virtual host? Obviously this is hard to do.
Generally speaking, method two is better than method one, but none of them are feasible.
Conclusion
If you want to put node. JS separately on a virtual host, the method is actually the same as ours (of course, if our virtual host is a more advanced virtual host that can log into the operating system interface or SSH). But if you want to be with other sites such as PHP, and the deployment of the same computer, if you can modify the server configuration file, then you can refer to the previous method two, if you can not, then there is little good way.
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the feasibility of the deployment of Nodejs on the virtual host, including the NODEJS, feasibility analysis of the content, I hope that the PHP tutorial interested in a friend helpful.