fraxture
fraxture

Reputation: 5510

How to Set up Ghost Blog Framework on Laptop Server

I'm trying to set up the Ghost blogging framework on my local laptop dev machine. I've followed the (basic installation instructions)[http://docs.ghost.org/installation/mac/] successfully. I am able to load the page by going directly to the IP, i.e. http://127.0.0.1:2368. I am however struggling to get the page to load via a url, i.e. mysite.localmachine.net. In the config.js file I have set things up like so:

config = {
    // ### Development **(default)**
    development: {
        // The url to use when providing links to the site, E.g. in RSS and email.
        url: 'http://myurl',

        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost-dev.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
    // When running Ghost in the wild, use the production environment
    // Configure your URL and mail settings here
    production: {
        url: 'http://myurl',
        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'
        }
    },
    ...
    ...
    ...

When I start the blog like so npm start --production, I get the following apparently successful load message:

> [email protected] start /Users/ethan/Sites/ghost
> node index

Ghost is running... 
Your blog is now available on http://myurl 

Ctrl+C to shut down

However, if I then navigate to http://myurl in my browser, I get a site not available message. I've also tried setting the port to 80, which I read as a possible solution (here)[http://www.howtoinstallghost.com/how-to-install-ghost-on-a-mac-os-x-10-8-mountain-lion/], but that produces an error that looks like this:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EACCES
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1020:19)
    at listen (net.js:1061:10)
    at net.js:1143:9
    at dns.js:72:18
    at process._tickCallback (node.js:415:13)
    at process._tickFromSpinner (node.js:390:15)
npm ERR! [email protected] start: `node index`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the ghost package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node index
npm ERR! You can get their info via:
npm ERR!     npm owner ls ghost
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 13.0.0
npm ERR! command "/usr/local/Cellar/node/0.10.25/bin/node" "/usr/local/bin/npm" "start" "--production"
npm ERR! cwd /Users/ethan/Sites/ghost
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/****/Sites/ghost/npm-debug.log
npm ERR! not ok code 0

I'm a bit stumped at this point and have not been able to find a clear explanation of the way to think about configuration anywhere. If anyone has any ideas, that would be wonderful.

Upvotes: 1

Views: 1125

Answers (2)

Alex Lehmann
Alex Lehmann

Reputation: 698

You cannot bind a program to port 80 unless you run the program as root and you shouldn't do that with an app server for security reasons.

If you bind to 0.0.0.0 or to your actual IP address, you will be able to access the blog with http://yourhost:2368/

To run the blog on port 80, keep the ip and port as 127.0.0.1:2368 and run an apache or nginx as front end proxy, this is run as root, but relinquishes the rights for the worker processes. The proxy requests then access your node.js server on localhost.

Also note that the message your blog is not available at http://yourhostname:2368/ does not mean that it is really accessible there, it is just the url configured in the config (i.e. which url will be used in absolute links like rss)

Upvotes: 2

Svbaker
Svbaker

Reputation: 706

Try changing your host from 127.0.0.1 to myurl:

production: {
    url: 'http://myurl',
    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()`
        // *** Change host value here ****
        host: 'myurl',
        // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
        port: '2368'
    }
},

In some situations, using localhost instead of 127.0.0.1 for the host value can work as well.

Here is my Ghost development setup process: http://seanvbaker.com/a-ghost-workflow/

Upvotes: 0

Related Questions