gpt4 book ai didi

ruby-on-rails - 502 网关错误,失败 (13 : Permission denied) - with Nginx and Unicorn

转载 作者:行者123 更新时间:2023-12-03 04:34:11 29 4
gpt4 key购买 nike

我正在尝试使用 Nginx 和 Unicorn 将 Rails 应用程序部署到 azure。我一直在关注这个tutorial当我读完教程并启动该网站时,我收到了 502 bad gateway 错误。在我的 nginx error.log 中,每个页面加载我都会得到这两行:

2015/05/10 19:04:37 [crit] 2784#0: *7 stat() "/var/www/offWhite/public/500.html" failed (13: Permission denied), client: 174.60.87.237, server: localhost, request: "GET / HTTP/1.1", upstream: "http://unix:/tmp/unicorn.offWhite.sock:/", host: "offfwhite.cloudapp.net"
2015/05/10 19:04:37 [crit] 2784#0: *7 connect() to unix:/tmp/unicorn.offWhite.sock failed (13: Permission denied) while connecting to upstream, client: 174.60.87.237, server: localhost, request: "GET / HTTP/1.1", upstream: "http://unix:/tmp/unicorn.offWhite.sock:/", host: "offfwhite.cloudapp.net"

我的 config/unicorn.rb 看起来就像教程中的一样:

# Set the working application directory
# working_directory "/path/to/your/app"
working_directory "/var/www/offWhite"

# Unicorn PID file location
# pid "/path/to/pids/unicorn.pid"
pid "/var/www/offWhite/pids/unicorn.pid"

# Path to logs
# stderr_path "/path/to/log/unicorn.log"
# stdout_path "/path/to/log/unicorn.log"
stderr_path "/var/www/offWhite/log/unicorn.log"
stdout_path "/var/www/offWhite/log/unicorn.log"

# Unicorn socket
listen "/tmp/unicorn.offWhite.sock"

# Number of processes
# worker_processes 4
worker_processes 2

# Time-out
timeout 30

我的 nginx default.conf 也是如此:

upstream app {
# Path to Unicorn SOCK file, as defined previously
server unix:/tmp/unicorn.offWhite.sock fail_timeout=0;

}

server {


listen 80;
server_name localhost;

# Application root, as defined previously
root /var/www/offWhite/public;

try_files $uri/index.html $uri @app;

location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app;
}

error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}

根据我在网上发现的情况,经常存在权限问题。如果还有其他选择的话,我还不想让 chmod 高兴。

非常感谢

亚历克斯

我不确定这是否应该因服务器故障而发生。如果它应该让我知道,我会将其删除。

编辑:

这是我每次启动服务器时在 unicorn.log 中得到的内容:

I, [2015-05-10T18:31:55.017694 #47698]  INFO -- : reaped #<Process::Status: pid 47701 exit 0> worker=0
I, [2015-05-10T18:31:55.017868 #47698] INFO -- : reaped #<Process::Status: pid 47703 exit 0> worker=1
I, [2015-05-10T18:31:55.018017 #47698] INFO -- : master complete
I, [2015-05-10T18:32:25.839675 #2048] INFO -- : unlinking existing socket=/tmp/unicorn.offWhite.sock
I, [2015-05-10T18:32:25.840092 #2048] INFO -- : listening on addr=/tmp/unicorn.offWhite.sock fd=10
I, [2015-05-10T18:32:25.840290 #2048] INFO -- : worker=0 spawning...
I, [2015-05-10T18:32:25.841098 #2048] INFO -- : worker=1 spawning...
I, [2015-05-10T18:32:25.841860 #2048] INFO -- : master process ready
I, [2015-05-10T18:32:25.845775 #2053] INFO -- : worker=1 spawned pid=2053
I, [2015-05-10T18:32:25.846049 #2053] INFO -- : Refreshing Gem list
I, [2015-05-10T18:32:25.853470 #2051] INFO -- : worker=0 spawned pid=2051
I, [2015-05-10T18:32:25.853751 #2051] INFO -- : Refreshing Gem list
I, [2015-05-10T18:32:28.002957 #2051] INFO -- : worker=0 ready
I, [2015-05-10T18:32:28.020675 #2053] INFO -- : worker=1 ready

最佳答案

我在解决问题几个月后才回答自己的问题,所以我没有在推论中使用的确切日志。

基本上,unicorn 的日志中有一个错误,因为我从未声明过生产数据库的 secret 。

关于ruby-on-rails - 502 网关错误,失败 (13 : Permission denied) - with Nginx and Unicorn,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30155640/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com