var app = require('express')();
var server = require('http').Server(app);
var io = require('socket.io')(server);
server.listen(3001);
module.exports = {
emit: function (channel, message) {
io.on('connection', function (socket) {
socket.emit(channel, message);
});
},
listen: function (callback) {
io.on('connection', function (socket) {
socket.on('message', function (msg) {
callback(msg);
});
});
}
};
var io = require("../modules/io");
io.emit('test', 'test test test');
var http = require('http');
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
server.listen(3000);
console.log("Server running at
var path = require('path');
var express = require('express');
var colors = require('colors')
var settings = require('./config/settings');
var environment = require('./config/environment');
var routes = require('./config/routes');
module.exports.start = function (done) {
var app = express();
environment(app);
routes(app);
app.listen(3000, function () {
console.log(("Listening on " + settings.port).green);
if (done) {
return done(null, app, server);
}
}).on('error', function (e) {
if (e.code == 'EADDRINUSE') {
console.log('Address in use. Is the server already running?'.red);
}
if (done) {
return done(e);
}
});
}
// If someone ran: "node server.js" then automatically start the server
if (path.basename(process.argv[1], '.js') == path.basename(__filename, '.js')) {
module.exports.start()
}
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
sendfile on;
keepalive_timeout 65;
tcp_nodelay on;
server_tokens off;
proxy_set_header Range "";
upstream php-fpm {
server 127.0.0.1:9000;
#server unix:/var/run/php5-fpm.sock;
}
server {
listen 88.198.0.40:80;
server_name localhost tools.hotel-inn.ru;
root /var/www/localhost;
auth_basic "Password, please!";
auth_basic_user_file /var/www/localhost/.htpasswd;
location / {
index index.php;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass php-fpm;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
include domain.conf;
}