New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-host

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-host

Simple node.js hosting on debian/ubuntu with nginx.

  • 0.1.2
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

nodehost

Quick Node.js hosting on ubuntu:

  • Multiple Node apps, served with nginx (as virtual hosts)
  • Service based (systemd)
  • Can be set to separate user per service
  • Restarts automatically on file update using nodemon
  • SSL support with letsencrypt/certbot
  • Alpha version

Install for using

As the user that should be the administrator of the hosting:

# Install Node.js if needed
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - && sudo apt-get install -y nodejs

npm install -g node-host
nodehost setup /hosting/dir --install-dependencies

Where /hosting/dir is where you want the hosts to reside on the server, for example /var/www.

(If you cannot use install -g with a non-root user, check out how to fix the npm permissions.)

Running

nodehost help
nodehost <command> [options...]

Use nodehost create <yourdomain.com> to create hosts, point the domain to the server, and you have a Node application up and running in less than a minute!

Useful files and dirs

After creating a host, example.com will have some points of interest:

  • Base dir: /hosting/dir/example.com
  • Service execution file: /hosting/dir/example.com/example.com
  • www dir: /hosting/dir/example.com/www
  • static files dir: /hosting/dir/example.com/www/public

Default behavior for the service execution file is to start nodemon for an app.js file in the www dir. Change the content as suited, but don't change the filename, since systemd depends on it.

Other useful locations for nodehost itself:

  • /etc/nginx/nodehost.conf.json - configuration file, created during setup
  • /etc/nginx/sites-available/nodehost*.conf - nginx files for each host
  • /etc/systemd/system/nodehost*.service - systemd files for each host

SSL/TLS/HTTPS

nodehost edit-nginx <yourdomain.com> to see details for generating either a self-signed certificate, or a real one with certbot. Note that only nginx is using the cert, the proxied connection between nginx and the Node app is http only (because they're on the same server).

How to uninstall

Until an uninstall command is in place:

  1. nodehost remove <hostname> for all hosts
  2. Delete /etc/nginx/nodehost.conf.json
  3. Delete /hosting/dir

Install for building/development

As the user that should be the administrator of the hosting:

# Install Node.js if needed
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - && sudo apt-get install -y nodejs

# Install Haxe if needed
sudo add-apt-repository ppa:haxe/releases -y
sudo apt-get update
sudo apt-get install haxe -y
mkdir ~/haxelib && haxelib setup ~/haxelib

# Clone the repo
git clone https://github.com/ciscoheat/nodehost.git && cd nodehost

# First time build
npm install
haxelib install nodehost.hxml
npm run build && npm link

# Setup
nodehost setup /hosting/dir --install-dependencies

Or if you have vagrant installed, do all of the above automatically with vagrant up. :)

Building

npm run build

FAQs

Package last updated on 16 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc