Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App: NginxOne #22

Open
simbora opened this issue Aug 19, 2014 · 0 comments
Open

App: NginxOne #22

simbora opened this issue Aug 19, 2014 · 0 comments

Comments

@simbora
Copy link
Owner

simbora commented Aug 19, 2014

Depends on Nginx.

Create the following dirs:

mkdir -p /var/log/nginx/foo

Create /etc/nginx/sites-available/foo with:

upstream foo {
    server localhost:3000;
}

server {
    listen 80;
    server_name domain.foo.bar;
    access_log /var/log/nginx/foo/access.log;
    error_log /var/log/nginx/foo/error.log;
    location / {
        proxy_pass http://foo;
        proxy_read_timeout 90;
    }
}

Create the following link

ln -s /etc/nginx/sites-available/foo /etc/nginx/sites-enabled/foo

Restart nginx

service nginx restart

Create upstart configuration /etc/init/foo.conf

description "Foo daemon"

start on (local-filesystems and net-device-up)
stop on runlevel [!2345]

expect daemon
respawn

exec start-stop-daemon --start --background --chuid deploy --exec /usr/local/bin/foo

Create run script /usr/local/bin/foo

#! /bin/bash

cd /srv/foo
node foo.js --port 3000 2>&1 |
    logger -t foo

Make it executable

chmod a+x /usr/local/bin/foo

Start it

start foo
@rxaviers rxaviers added this to the Apps deployment milestone Aug 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants