Skip to content

Instantly share code, notes, and snippets.

@connrs
Created February 2, 2014 15:24
Show Gist options
  • Save connrs/8769890 to your computer and use it in GitHub Desktop.
Save connrs/8769890 to your computer and use it in GitHub Desktop.
Ghost Blog Configuration (Apache, Ubuntu Upstart)
#!/bin/bash
NODE_ENV=production /home/myuser/local/bin/node /home/myuser/www/index.js
<VirtualHost 77.73.1.223:80>
ServerName ghostblog.example.com
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:2368/
ProxyPassReverse http://localhost:2368/
</Location>
</VirtualHost>
#!upstart
description "MyUser Ghost Blog"
author "myuser"
start on startup
stop on shutdown
respawn
respawn limit 10 20
chdir /home/myuser/www/
script
echo $$ > /home/myuser/run/upstart-ghost.pid
exec sudo -u myuser '/home/myuser/bin/ghost' >> /home/myuser/ghost.log 2>&1
end script
pre-start script
# Date format same as (new Date()).toISOString() for consistency
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /home/myuser/ghost.log
end script
pre-stop script
rm /home/myuser/run/upstart-ghost.pid
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> /home/myuser/ghost.log
end script
@connrs
Copy link
Author

connrs commented Feb 2, 2014

The user-blog.conf file is the upstart config file. You would place this within /etc/init/ so that Upstart can use it on boot.

The ghost file is a binary that would live within /home/myuser/ that is called by the Upstart script

The user-blog.conf file is the Apache2 VirtualHost configuration. It makes use of Apache's proxy capabilities to pass requests to your domain through to the Ghost application running on port 2368.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment