2017-05-10 60 views
0

我想設置我的Rails服務器和乘客不會承認我的應用程序日誌上給這個錯誤:乘客不會找到的公共路徑

[error] 1473#1473: *1 "/home/myapp/public/index.html" is not found (2: No such file or directory) 

或客戶端404錯誤。

我已經完成了所有解決疑難問題的解決方案,但沒有解決問題。

這裏是我的服務器塊:

server { 
    listen 80; 
    server_name mydomaiin.com; 
    rails_env development; 

    # Turn on Passenger 
    passenger_enabled on; 
    passenger_ruby /home/myapp/.rbenv/versions/2.4.0/bin/ruby; 

    # Tell Nginx and Passenger where your app's 'public' directory is 
    root /home/myapp/public; 
} 

誰能幫助我?

感謝

+0

什麼是您的應用程序的路徑? – puneet18

+0

運行命令'pwd'並檢查它 – puneet18

+0

/home/myapp/myapp – Icaro

回答

1

當你的根目錄是在/home/myapp/myapp,更新您的服務器的conf:

server { 
    listen 80; 
    server_name mydomaiin.com; 
    rails_env development; 

    # Turn on Passenger 
    passenger_enabled on; 
    passenger_ruby /home/myapp/.rbenv/versions/2.4.0/bin/ruby; 

    # Tell Nginx and Passenger where your app's 'public' directory is 
    root /home/myapp/myapp/public; 
} 
+0

完美地工作,但是wy?實際上我的應用程序在/ home/myapp中。所以你有更多的「/ myapp」? – Icaro

+0

@Icaro您的應用程序位於/ home/myapp/myapp目錄中,您可以通過命令「pwd」檢查dir結構。 – puneet18

+0

接受我的答案,如果它適合你。謝謝 – puneet18