Download from here:
MD5: 59bab8f71f8c096cd3f72cd73851515d
Rename it to:
<?php | |
/** | |
* @author Antoine Bluchet | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
/* app.js */ | |
var server = http.createServer(app).listen(app.get('port'), function(){ | |
console.log('Express server listening on port ' + app.get('port')); | |
}); | |
var io = require('./utils/sockets').listen(server); //for example | |
/* utils/sockets.js */ | |
var socketio = require('socket.io'); |
## The Problem | |
Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.) | |
## The temptingly easy but ultimately wrong solution: | |
Alter the port the script talks to from 8000 to 80: | |
}).listen(80); |
#!/bin/bash | |
# Adding mongodb source | |
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 | |
echo 'deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' | tee /etc/apt/sources.list.d/10gen.list | |
apt-get update | |
# Dependecies | |
# whois = mkpasswd |
Download from here:
MD5: 59bab8f71f8c096cd3f72cd73851515d
Rename it to:
#!/bin/bash | |
# chkconfig: 2345 98 02 | |
# | |
# description: PM2 next gen process manager for Node.js | |
# processname: pm2 | |
# | |
### BEGIN INIT INFO | |
# Provides: pm2 | |
# Required-Start: $local_fs $remote_fs | |
# Required-Stop: $local_fs $remote_fs |
d_start() { | |
} | |
d_stop() { | |
} | |
case "$1" in |
app.config(function($stateProvider, $urlRouterProvider, $locationProvider) { | |
$locationProvider.hashPrefix('!').html5Mode(true) | |
}) | |
app.run(function($rootScope, $location) { | |
$rootScope.$on('$locationChangeStart', function(e, next, current) { | |
//prevent first load |
process.env.DEBUG = '*' | |
var express = require('express') | |
var app = express() | |
var middleware = function(req, res, next) { | |
console.log('Trying to put a middleware here') | |
next(null) | |
}, |