我正嘗試使用curl http://192.168.1.11:4000/api/v1/login
與我的應用程序的api連接,但我總是得到錯誤curl: (7) Failed to connect to 192.168.1.11 port 4000: Connection refused
。無法訪問curl http:// ip_address:3000
而如果我使用本地主機curl http://localhost:4000/api/v1/login
它允許連接到服務器。
奇怪的是我能夠使用IP地址curl http://192.168.1.11:3000
爲我的另一個項目沒有任何錯誤。
它是如何解決的。
快速的事實:當你使用'http:// localhost:4000'它沒有連接到'http://192.168.1.11:4000',它將轉到'http://127.0.0.1:4000'。 (除非顯然你沒有搞亂你的hosts文件) – shivam
聽起來像你綁定你的應用程序到localhost只有 –
你知道你在你的問題和最後的例子中說'3000',但在你的第一個例子中'4000'? – jrochkind