Install and Run node.js on a server
Install and Run node.js on a server
Hello, everyone. This is actually my first day of being a member of this great forum. I have found out about this forum from hallsofvallhalla's YouTube tutorials regarding node.js.
I have watched the entire series of his tutorial for beginners in node.js development. He has taught well and I followed everything that he demonstrated. I have implemented node.js and socket.io using WAMP (localhost) after following instructions from his video tutorials.
The problem is, I do not know how to install and run node.js on my remote server.
I have a personal hosting with 1 GB Disk Space and 10 GB Bandwidth, and it is provided by a local company here in the Philippines. Is this enough to install and run node.js and socket.io in my server? If it is, please state how.
Thank you.
I have watched the entire series of his tutorial for beginners in node.js development. He has taught well and I followed everything that he demonstrated. I have implemented node.js and socket.io using WAMP (localhost) after following instructions from his video tutorials.
The problem is, I do not know how to install and run node.js on my remote server.
I have a personal hosting with 1 GB Disk Space and 10 GB Bandwidth, and it is provided by a local company here in the Philippines. Is this enough to install and run node.js and socket.io in my server? If it is, please state how.
Thank you.
Re: Install and Run node.js on a server
The disk space and bandwidth aren't important. You need SSH or Telnet access for a Linux server. If it's running windows Remote Desktop will do.
Fighting for peace is declaring war on war. If you want peace be peaceful.
Re: Install and Run node.js on a server
Oh. Sorry, but I do not know much about networking. I also do not know what operating system are my servers running.Chris wrote:The disk space and bandwidth aren't important. You need SSH or Telnet access for a Linux server. If it's running windows Remote Desktop will do.
ADD: I asked my provider, they are using Linux CentOS.
Re: Install and Run node.js on a server
Is it a shared hosting package or a VPS? Do you have SSH access? What operating system are you running on your local machine?
Fighting for peace is declaring war on war. If you want peace be peaceful.
Re: Install and Run node.js on a server
This is a bit disappointing. I contacted my provider and asked them, my hosting is on a shared environment and it's not running SSH.
I was planning to use node.js and socket.io in my project, but it seems like it's impossible to do it with my server features. Do you have any alternative ways to create an interaction between two players in an HTML5 based game? It's a card game that has interaction between a maximum of two players, but it may have a tons of players playing at the same time. I want to avoid spamming on my server.
I was planning to use node.js and socket.io in my project, but it seems like it's impossible to do it with my server features. Do you have any alternative ways to create an interaction between two players in an HTML5 based game? It's a card game that has interaction between a maximum of two players, but it may have a tons of players playing at the same time. I want to avoid spamming on my server.
Re: Install and Run node.js on a server
Fighting for peace is declaring war on war. If you want peace be peaceful.
Re: Install and Run node.js on a server
Thank you, Chris!
This is great. For now, I will take time to read about this PHP WebSockets.
This is great. For now, I will take time to read about this PHP WebSockets.
Re: Install and Run node.js on a server
Here's the second step of the procedure from the link that you have given me.
It still needs a command line to run a server.php program and listen for socket connections. I am on a shared hosting and I don't have a direct access on the remote server that I am using. Will it still be possible for me to use this?From the command line, run the server.php program to listen for socket connections.
Last edited by JetPro on Mon Apr 29, 2013 10:53 am, edited 1 time in total.
Re: Install and Run node.js on a server
This script should be able run your server.php script as the user "Apache" on the server.
The `'s allow you to run things from the shell. You can also use the function shell_exec().
You might be able to get root access to the server using sudo.
Check to see what that returns. If it prompts for a password you have to run as Apache. Otherwise your server is insecure enough to play around with.
http://www.php.net/manual/en/function.s ... .php#68685
Code: Select all
$serverResult = `php server.php`;
echo $serverResult;
You might be able to get root access to the server using sudo.
Code: Select all
echo `su -h`;
http://www.php.net/manual/en/function.s ... .php#68685
If you want to execute shell commands as root theres another workaround.
It will readout the file 'passfile' that you've hidden under quite some dirs (to make it a bit less insecure) and use the content as password to login as root.Code: Select all
<?php shell_exec('sudo -u root -S command_goes_here < /home/$User/dir/dir/dir/passfile'); ?>
Note that storing your root password is far from secure but it's an easy way to execute commands under root in controlled environments.
Nathan De Hert
Fighting for peace is declaring war on war. If you want peace be peaceful.
Re: Install and Run node.js on a server
I tried to run this:
It did not return anything, it is not also requiring a password. It just displayed a plain webpage with no content.
I do not understand any of this code.
Code: Select all
echo `su -h`;Code: Select all
<?php
shell_exec('sudo -u root -S command_goes_here < /home/$User/dir/dir/dir/passfile');
?>