How to Setup Ghost as Intranet Network

2015/7/312 min read
bookmark this
Responsive image

So following How to setup Ghost(node.js) at window server, you could setup Ghost at Production server or use as local development. This blog show how to setup as Production but use inside the company's network as Intranet.

After you install all software and able to run on your local server, you need to following thing to hack the system so you can use as Intranet.

 

1. disable url and ip address validation check

go to /core/server/config/index.js, find the line which are doing the url, hostname check and comment out thest.


// Check that our url is valid //if (!validator.isURL(config.url, {protocols: ['http', 'https'], require_protocol: true})) { // errors.logError(new Error('Your site url in config.js is invalid.'), config.url, 'Please make sure this is a valid url before restarting'); // return Promise.reject(new Error('invalid site url')); //}


// Check for valid server host and port values // TODO: it's checking the server name to be public. //if (!config.server || !(hasHostAndPort || hasSocket)) { // errors.logError(new Error('Your server values (socket, or host and port) in config.js are invalid.'), JSON.stringify(config.server), 'Please provide them before restarting.'); // return Promise.reject(new Error('invalid server configuration')); //}

2. config.js production enviroment setup


config = {
    // ### Production
    // When running Ghost in the wild, use the production environment
    // Configure your URL and mail settings here
    production: {
        url: 'http://my-development-server/',
        mail: {
			transport: 'SMTP',
				options: {
					service: 'Mailgun',
					auth: {
						user: 'if you use mailgun, then put mailgun's email',
						pass: 'mail gun's password'
					}
				}
			},
        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: 'your server's ip address',
            // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
            port: process.env.PORT
        }
    },

If you other part is already work, like site is already up and web server run as IIS and use iisnode. In that case, you don't need to change anything, just F5 your browser.