【发布时间】:2014-05-11 18:14:59
【问题描述】:
我刚刚设置了 nginx 和 unicorn。我这样开始独角兽:
unicorn_rails -c /var/www/Web/config/unicorn.rb -D
我已经尝试了各种停止独角兽的命令,但都不起作用。我通常只是重新启动服务器并重新启动独角兽,但这很烦人。
编辑
unicorn.rb 文件(/var/www/Web/config/):
# Set the working application directory
# working_directory "/path/to/your/app"
working_directory "/var/www/Web"
# Unicorn PID file location
# pid "/path/to/pids/unicorn.pid"
pid "/var/www/Web/pids/unicorn.pid"
# Path to logs
# stderr_path "/path/to/log/unicorn.log"
# stdout_path "/path/to/log/unicorn.log"
stderr_path "/var/www/Web/log/unicorn.log"
stdout_path "/var/www/Web/log/unicorn.log"
# Unicorn socket
listen "/tmp/unicorn.Web.sock"
listen "/tmp/unicorn.Web.sock"
# Number of processes
# worker_processes 4
worker_processes 2
# Time-out
timeout 30
default.conf (/etc/nginx/conf.d/):
upstream app {
# Path to Unicorn SOCK file, as defined previously
server unix:/tmp/unicorn.Web.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
# Application root, as defined previously
root /root/Web/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;
}
【问题讨论】:
-
/etc/init.d/unicorn_Xxx 重载
-
我得到这个结果:/etc/init.d/unicorn_Web: No such file or directory
-
你应该用你的独角兽文件替换 unicorn_xxx 你用过 capistrano 吗?如果是,则使用 reload/stop/start 放置独角兽的路径
-
我没有使用 capistrano 进行部署,但我在问题中包含了更多信息
-
也粘贴你的 unicorn sh 文件
标签: ruby-on-rails ruby ruby-on-rails-4 nginx unicorn