Question

How do I configure my subdomain for nginx and digitalocean?

  • Posted August 21, 2014

Digital Ocean pre-build image : Ghost 0.5 on Ubuntu 14.04

I followed a few guides, but I can’t seem to get it to work correctly, what am I doing wrong? I want davedh2.com to host my personal site, and have blog.davedh2.com for my ghost blog.

my DNS: http://picpaste.com/pics/Screen_Shot_2014-08-21_at_1.45.40_PM-Nz9gcgnR.1408654168.png

my nginx/sites-available file

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    server_name davedh2.com; # Replace with your domain

    location / {
         root /usr/share/nginx/davedh2;
    	 index index.html index.htm;
    } 
}

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    server_name blog.davedh2.com; # Replace with your domain
    access_log /var/log/nginx/ghost.log


    client_max_body_size 10G;

    location / {
        proxy_pass http://localhost:2368;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
    } 
}

my config.js

// ### Production
    // When running Ghost in the wild, use the production environment
    // Configure your URL and mail settings here
    production: {
        url: 'http://davedh2.com',
        mail: {},
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            },
            debug: false
        },
        server: {
            // Host to be passed to node's `net.Server#listen()`
            host: '127.0.0.1',
            // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
            port: '2368'
        }
    },

Thank you.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hey Andrew,

Yes, I did create the directory, and there is an index.html. I didn’t know that I had to execute the command service ghost restart, lol just found about it. Now, I can go back and forth within the blog, but I’m still unable to load my index.html from /urs/share/nginx/davdh2.

as for the config.js do you mean like this? Thank you.

// ### Production // When running Ghost in the wild, use the production environment // Configure your URL and mail settings here production: { url: ‘http://blog.davedh2.com’, mail: {}, database: { client: ‘sqlite3’, connection: { filename: path.join(__dirname, ‘/content/data/ghost.db’) }, debug: false }, server: { // Host to be passed to node’s net.Server#listen() host: ‘127.0.0.1’, // Port to be passed to node’s net.Server#listen(), for iisnode set this to process.env.PORT port: ‘2368’ } },

production: {
    url: 'http://davedh2.com',
    mail: {},
    database: {
        client: 'sqlite3',
        connection: {
            filename: path.join(__dirname, '/content/data/ghost.db')
        },
        debug: false
    },
    server: {
        // Host to be passed to node's `net.Server#listen()`
        host: '127.0.0.1',
        // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
        port: '2368'
    }
},

// **Developers only need to edit below here**

That mostly looks right to me. Except if you want the Ghost blog on the subdomain, you should set it in config.js as well:

    production: {
        url: 'http://davedh2.com',

Does the directory /usr/share/nginx/davedh2 actually exist? Is there an index.html file there?