Skip to content

Instantly share code, notes, and snippets.

@JustGoscha
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JustGoscha/fc19c8585446936cdba4 to your computer and use it in GitHub Desktop.
Save JustGoscha/fc19c8585446936cdba4 to your computer and use it in GitHub Desktop.
NodeJS server configuration best practices
#Best practices when running Node.js with port 80 (Ubuntu / Linode):
http://stackoverflow.com/questions/16573668/best-practices-when-running-node-js-with-port-80-ubuntu-linode
# Running stuff in background, handling child processes, storing PIDs etc.:
http://mywiki.wooledge.org/ProcessManagement#How_do_I_kill_a_process_by_name.3F__I_need_to_get_the_PID_out_of_ps_aux_.7C_grep_....
# Git for website management
http://toroid.org/ams/git-website-howto
http://programmers.stackexchange.com/questions/210851/how-to-make-a-git-push-update-files-on-your-web-host
http://stackoverflow.com/questions/883878/update-website-with-a-single-command-git-push-instead-of-ftp-drag-and-dropping
# Enabling browser caching
http://stackoverflow.com/questions/16096578/how-to-cache-a-single-resource-with-express-nodejs
# start things on linux startup
/etc/rc.local
# start server not as root
sudo start-stop-daemon --start --chuid justgoscha --exec startup.sh --chdir /opt/node-servers/watchnext/
# check if the user is really not root ...should be above 1000
ps aux | grep yourscript
# log rotation
logrotate
config in /etc/logrotate.d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment