

Here is an example of what you may want to add to /etc/rc.local. Ensure that it's executable and open it in a text editor: $ sudo chmod +x /etc/rc.local This script is called during system boot. The easiest way to do that is to add it to the file /etc/rc.local. So you must configure your server to start Passenger Standalone on system boot. Passenger is now running and serving your app, but that only lasts until you reboot your server. 3.5 Make sure Passenger Standalone starts on system boot In the mean time, we recommend that you use your server's IP address as the server name. Setting up DNS is outside the scope of this tutorial. If you do not see your app's front page HTML, then the most likely cause is that you did not setup DNS records. You should now be able to access your app through the server's host name! Try running this from your local computer. Only root privileged processes can listen on ports lower than 1024. Note that, because Passenger is configured to listen on port 80, this command must be run with root privileges. As configured, it will start on port 80 and will daemonize into the background.
Node.js for mac code#
While in your application's code directory, start Passenger. # Type `exit` to go back to the account you were before myappuser$ exit For example: # This is what you previously ran: admin$ sudo -u myappuser -H bash -l You will then be dropped back to the admin account. This can be done by simply exiting the shell that was logged into the app's user account. So you need to switch back to the admin account. In the next steps, you need to start Passenger with root privileges, for which sudo access is needed. You have previously logged into your app's user account in order to prepare the app's environment. Replace myappuser with your app's user account name. Go to your application'sĪnd create a file named Passengerfile.json: $ cd /var/www/ myapp/code Since this is a production environment, we need to customize Passenger a little bit. Now that you are done with transferring your app's code to the server and setting up an environment for your app, it is time to start your app in Passenger. Installing services that your app depends on is outside of this tutorial's scope. Your app may also depend on services, such as PostgreSQL, Redis, etc.
Node.js for mac install#
You can install them by running npm install in your app's directory: $ cd /var/www/ myapp/code

Most of these dependencies are Javascript libraries, managed by npm. Your application has various dependencies.

While logged into your server, login under the application's user account as follows: $ sudo -u myappuser -H bash -l 2.2 Install app dependencies Your app's code now lives on the server at /var/Login as the app's userĪll subsequent instructions must be run under the application's user account. If you are using our sample app, use this Git clone command instead: $ cd /var/www/ myapp $ sudo -u myappuser -H git clone -branch=master code $ sudo sh -c "chmod 600 ~ myappuser/.ssh/*" 1.3 Install Git on the server $ sudo sh -c "cat $HOME/.ssh/authorized_keys > ~ myappuser/.ssh/authorized_keys" $ sudo chown -R myappuser: ~ myappuser/.ssh We also ensure that that user has your SSH key installed: $ sudo mkdir -p ~ myappuser/.ssh But for demonstration purposes, this tutorial names the user account myappuser. You should give the user account the same name as your app. Passenger will automatically run your app under this user account as part of its user account sandboxing feature. For security reasons, it is a good idea to run each app under its own user account, in order to limit the damage that security vulnerabilities in the app can do. Now that you have logged in, you should create an operating system user account for your app. Starting from this point, unless stated otherwise, all commands that we instruct you to run should be run on the server, not on your local computer!
