2014-01-29 79 views
1

我試圖在我的本地筆記本電腦開發機器上設置Ghost博客框架。我已經成功地遵循了(基本安裝說明)[http://docs.ghost.org/installation/mac/]。我可以通過直接進入IP來加載頁面,即http://127.0.0.1:2368。然而,我努力讓頁面通過url加載,即mysite.localmachine.net。在config.js文件我已經設置的東西,就像這樣:如何設置筆記本電腦服務器上的Ghost博客框架

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' 
     } 
    }, 
    ... 
    ... 
    ... 

當我開始像這樣npm start --production的博客,我得到如下明顯成功的負載消息:

> [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 

但是,如果我然後在我的瀏覽器中導航到http://myurl,我收到一個網站不可用的消息。我也嘗試將端口設置爲80,我認爲這是一個可能的解決方案(此處)[http://www.howtoinstallghost.com/how-to-install-ghost-on-a-mac-os-x- 10-8山獅/],但產生,看起來像這樣的錯誤:

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 

我有點在這一點難倒並沒有能夠找到的方式來解釋清楚想想任何地方的配置。如果任何人有任何想法,這將是美好的。

回答

0

試着改變你的主機從127.0.0.1myurl

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' 
    } 
}, 

在某些情況下,使用localhost代替127.0.0.1主機值可以正常工作。

這裏是我的鬼開發安裝過程:除非你運行該程序的根,你不應該做http://seanvbaker.com/a-ghost-workflow/

2

您可以在程序不綁定到端口80,與出於安全原因,一個應用程序服務器。

如果您綁定到0.0.0.0或您的實際IP地址,您將能夠訪問該博客與http://yourhost:2368/

運行在端口80上的博客,保持IP和端口爲127.0.0.1: 2368並運行apache或nginx作爲前端代理,這是以root身份運行的,但放棄了工作進程的權限。代理請求然後在本地主機上訪問您的node.js服務器。

另外請注意,您的博客是不是可以在http://yourhostname:2368/消息並不意味着它是很容易得到那裏,它只是在config中配置的URL

(即其URL將像RSS絕對鏈接使用)
相關問題