2016-01-27 200 views
0

連接到我的NodeBB安裝使用我的域名時,我得到502網關 NodeBB的默認端口上運行(4567)nginx的502錯誤網關與NodeBB

我nginx的似乎是正確配置(使用IP連接時):http://puu.sh/mLI7U/0e03691d4c.png 我的nodebb似乎配置正確(當使用IP連接時): http://puu.sh/mLI95/5fdafcaed9.png 我的A記錄將IP指向我的VPS已正確配置。

這是我等/ nginx的/ conf.d/example.com.conf

server { 
listen 80; 

server_name sporklounge.com; 

location/{ 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header Host $http_host; 
    proxy_set_header X-NginX-Proxy true; 

    proxy_pass http://127.0.0.1:4567/; 
    proxy_redirect off; 

    # Socket.IO Support 
    proxy_http_version 1.1; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection "upgrade"; 
} 

}

My NodeBB config.json 
{ 
    "url": "http://localhost:4567", 
    "secret": "25d0d6a2-0444-49dc-af0c-bd693f5829d8", 
    "database": "redis", 
    "redis": { 
     "host": "127.0.0.1", 
     "port": "6379", 
     "password": "", 
     "database": "0" 
    } 
} 

這是我無功/日誌/ nginx的/ error.log中

2016/01/27 12:04:42 [error] 22026#0: *4062 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 50.186.224.26, server: sporklounge.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:80/favicon.ico", host: "sporklounge.com", referrer: "http://sporklounge.com/" 
2016/01/27 12:21:06 [crit] 974#0: *1 connect() to 127.0.0.1:4567 failed (13: Permission denied) while connecting to upstream, client: 50.186.224.26, server: sporklounge.com, request: "GET/HTTP/1.1", upstream: "http://127.0.0.1:4567/", host: "sporklounge.com" 
2016/01/27 12:21:07 [crit] 974#0: *1 connect() to 127.0.0.1:4567 failed (13: Permission denied) while connecting to upstream, client: 50.186.224.26, server: sporklounge.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:4567/favicon.ico", host: "sporklounge.com", referrer: "http://sporklounge.com/" 

所有幫助非常感謝,我將回答所有我可以幫助獲得解決方案的問題,謝謝!

回答

0

有一件事我看到的是,根據the docs,你url配置值應該是指向你NodeBB的全網絡訪問的地址。那將是sporklounge.com,而不是當前值。

也可能是後端有時只是響應緩慢。嘗試在Nginx的這個值非常高的值,看看後臺最終迴應:

# For testing, allow very long response times. 
proxy_read_timeout 5m; 

此外,使用netstat來確認後端在端口4567上運行:

sudo netstat -nlp | grep ':4567' 

等待,答案可能就在你的日誌,它給你的連接失敗的原因:

(13:權限被拒絕),而連接到上游

請參閱相關的問題:

+0

的許可權被拒絕後固定我的問題。非常感謝! – Aris