我需要部署我的Rails应用程序,因此我已经按照这里的所有步骤进行了操作:https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-puma-and-nginx-on-ubuntu-14-04
但是在教程结束时,我得到了这个错误-->“502 Bad Gateway”
编辑
现在的错误消息是-->"We're sorry, but something went wrong."
但Nginx的错误输出仍然相同,我检查了Puma的错误消息,但它们只在启动和优雅停止时记录。
位于app_directory/log下的Rails日志没有产生任何输出。
puma-manager-->我已经检查过它能正常工作
路径--->我已经检查了三遍
Nginx error.log的输出信息:
2016/05/18 14:22:21 [crit] 1099#0: *7 connect() to unix:/home/deploy /hotel-automata/shared/sockets/puma.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.2.105, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:/home/deploy/hotel-automata/shared/sockets/puma.sock:/500.html", host: "192.168.2.170"
操作系统 -> Vmware Player,桥接网络Ubuntu Server 14.0.4
Ruby版本:2.3.1
Rails版本:4.2.5.2
这是我的nginx配置内容 /etc/nginx/sites-available/default
upstream app {
# Path to Puma SOCK file, as defined previously
server unix:/home/deploy/hotel-automata/shared/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
root /home/deploy/hotel-automata/public;
try_files $uri/index.html $uri @app;
location @app {
proxy_pass http://app;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
puma.sock
文件的权限吗?当我使用uwsgi
和nginx
时,我曾经遇到过这种错误。 - manoj prashant kunix:/home/deploy/hotel-automata/shared/sockets/puma.sock
改为unix:///home/deploy/hotel-automata/shared/sockets/puma.sock
并尝试一下吗? - manoj prashant k