How to Host Ghost on a Nginx Subdomain

If you currently have a website running on an Nginx web server and you are interested in installing Ghost on a subdomain this walk through will detail how to setup it up. After this tutorial you will have your main domain (we will use the domain served by Nginx and your Ghost blog on a subdomain ( served by Node.js.

The Nginx default location for your website is /usr/share/nginx/html so we are going to stick with that. We are going to make the primary website in the directory /usr/share/nginx/html/ and the Ghost blog in /usr/share/nginx/html/

To tell Nginx about your new blog we need to edit the Nginx default.conf file. The file by default is located at /etc/nginx/conf.d/default.conf. Edit that file:

 sudo vi /etc/nginx/conf.d/default.conf

Now at the very bottom of the file add in the following (changing the server_name to your site):

 #Following section for
 server {
     listen 80;

     location / {
             proxy_set_header Host $host;
             proxy_buffering off;

You can reference our sample Nginx default.conf file for help.

Once that is saved we need to restart Nginx so that it will load these changes.

sudo service nginx restart

Now in your browser you can open your blog subdomain,, and Node.js will serve your Ghost blog!