Celeb Glow
news | March 22, 2026

How configure the upstart in ubuntu in my ec2 [node.js]

I am using an amazon ec2 instance with ubuntu to host my node.js application, i already made all the configurations, and is working good when i type:

nodemon ./bin/www

./bin/www is the file that creates the server.

Now, i am trying to setup the upstart, and i follow a tutorial, this is my configuration file:

path:

/etc/init/photogrid.conf:

inside:

description "Photogrid"
start on started mountall
stop on shutdown
respawn
respawn limit 99 5
env NODE_ENV=production
exec node /home/ubuntu/photogrid/bin/www >> /var/log/photogrid.log 2>&1

But when i try to access the site, is showing:

Cannot GET /

I follow a tutorial, and the only difference between my configuration file is this part:

Original:

exec node /home/ubuntu/photogrid/app.js >> /var/log/photogrid.log 2>&1

My one:

exec node /home/ubuntu/photogrid/bin/www >> /var/log/photogrid.log 2>&1

Start with upstart:

Start with nodemon bin/www:

In my logs i see the following when i try access the '/' (just an example, in every route is the same problem):

^[[0mGET / ^[[33m404 ^[[0m12.036 ms - 13^[[0m

Thanks very much!

1 Answer

It could be problem with the working directory. Try using chdir:

description "Photogrid"
...
chdir /home/ubuntu/photogrid
exec node /home/ubuntu/photogrid/bin/www

On a side note: The redirection isn't needed. The log is saved to files in /var/log/upstart/.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy