Installing Node.js + Ghost in an Ubuntu 14.04 LXC Container
I had to set up a blog for an interaction design course that I am taking this semester. I figured this would be the perfect opportunity to play with Node.js and work with the absolutely beautiful Ghost blogging platform. I installed all of this on my primary Linode server that hosts this blog among other things. I like to keep my server neat, so whenever I am working with a new technology that I have not used before, especially when I know it is going to install a bunch of random files and run a bunch of random scripts that I will never be able to track down, I like to put it all into an LXC Container. Aside from a few snags, the installation was pretty straightforward. I followed theinstallation guide on the Ghost github site and had to make a couple small changes due to this issue. The interesting part of this was getting the container to be accessible from the outside world. I used apache’s mod_proxy module to forward requests to the new subdomain that I created directly to Ghost which was running in my LXC container. I have seen a couple different approaches to making containers accessible to the outside world but I think that this approach works well especially if you are hosting multiple sites on the same server.
Installing Your Container
I suppose this part is optional, you can just as well run this in a regular server or VM. However, if you like to put things into tiny little boxes like me, read on! The following should be run as root.apt-get install lxclxc-create -t download -n nodejs
During the template selection choose ubuntu, trusty, and amd64
Start the Container as a Daemon
lxc-start -n nodejs -d
Open a screen session to attach the container.
Why? Because “If it’s worth doing, it’s worth doing in screen”
screen -dRR node
lxc-attach -n nodejs
Installing Node.js and Ghost
Now that we have our shiny new container, lets get Node.js and Ghost installed. Since containers come with a very minimal set of software, we will install some additional utilities as well. The following should be run as root inside of your container. The only change I had to make from the official install guide was installing nodejs-legacy along with all the other stuff. Take a look at the issue linked to above if you are interested in more information.apt-get install wget unzip nodejs npm nodejs-legacyCreate a Directory for your Ghost blog and go into it
mkdir ghost cd ghost
Download and Unzip Ghost
wget https://ghost.org/zip/ghost-0.5.8.zip
unzip ghost-0.5.8.zipInstall Ghost
npm install –production
Since we are in a container, in order to be able to access ghost from the host
machine we will need to edit the config.js file and change the values of 127.0.0.1 to 0.0.0.0.
vim config.js
:%s/127.0.0.0.1/0.0.0.0/gStart Ghost
npm start
root@hci:/ghost#npm start
> ghost@0.5.8 start /ghost > node index Migrations: Up to date at version 003 Ghost is running in development… Listening on 0.0.0.0:2368 Url configured as: http://localhost:2368 Ctrl+C to shut down
Apache Proxy to Container
The last step of this is to set up the Virtual Host config file to proxy requests to our new Node.js container.# Grab the IP address of your container lxc-ls --fancyLoad the appropriate apache proxy modules
a2enmod proxy
a2enmod proxy_httpConfigure the Virtual Host file to set up the proxy it should look something like this. Be sure to replace the IP address listed below with the IP address of your actual container.
<VirtualHost *:80>
Admin email, Server Name (domain name), and any aliases
ServerAdmin [email protected]
ServerName hci.levlaz.orgProxyVia full
ProxyPreserveHost on<proxy>
Order deny,allow
Allow from all</proxy>
ProxyPass / https://10.0.3.101:2368/
ProxyPassReverse / https://10.0.3.101:2368/</Virtualhost>
Restart apache to clean things up
service apache2 restart
Thank you for reading! Share your thoughts with me on bluesky, mastodon, or via email.
Check out some more stuff to read down below.
Most popular posts this month
- 2024
- Setting up ANTLR4 on Windows
- My Custom Miniflux CSS Theme
- SQLite DB Migrations with PRAGMA user_version
- Ten Years of Dreaming of San Francisco
Recent Favorite Blog Posts
This is a collection of the last 8 posts that I bookmarked.
- Fedora Magazine: Contribute to Fedora 44 KDE and GNOME Test Days from Fedora People
- Pluralistic: bunnie's piggyback hack (09 Jan 2026) from Pluralistic: Daily links from Cory Doctorow
- Clicks Communicator from Chris Hannah
- A Year Of Vibes from Armin Ronacher's Thoughts and Writings
- Pluralistic: A perfect distillation of the social uselessness of finance (18 Dec 2025) from Pluralistic: Daily links from Cory Doctorow
- Moving from WordPress to Substack from charity.wtf
- Grow, Like a Tree Not a Cancer from Jim Nielsen’s Blog
- Pluralistic: All the books I reviewed in 2025 (02 Dec 2025) from Pluralistic: Daily links from Cory Doctorow
Articles from blogs I follow around the net
Announcing Live AI & Design Systems Jam Sessions!
Ian, TJ, and I are excited to announce live AI & Design Systems Jam Sessions with our AI & Design Systems course community! Our first jam session will be Thursday, February 26 at 10AM ET. In these recurring biweekly Zoom […]
via Blog – Brad Frost February 16, 2026I Sold Out for $20 a Month and All I Got Was This Perfectly Generated Terraform
Until recently the LLM tools I’ve tried have been, to be frank, worthless. Copilot was best at writing extremely verbose comments. Gemini would turn a 200 line script into a 700 line collection of gibberish. It was easy for me to, more or less, ignore LLM…
via matduggan.com February 16, 2026Pluralistic: The online community trilemma (16 Feb 2026)
Today's links The online community trilemma: Reach, community and information, pick two. Hey look at this: Delights to delectate. Object permanence: Bruces x Sony DRM; Eniac tell-all; HBO v PVRs; Fucking damselflies; Gil Scout Cookie wine-pairings; Bi…
via Pluralistic: Daily links from Cory Doctorow February 16, 2026Generated by openring