问题描述
当我运行以下命令在我的 Vagrant 盒子 (ubuntu-12.04.2-server-i386) 上为 Sinatra 应用程序启动 Unicorn 时
When I run the following command to start Unicorn for a Sinatra app on my Vagrant box(ubuntu-12.04.2-server-i386)
sudo unicorn -c unicorn.rb -E development -D -l 0.0.0.0:8080
我在 Unicorn 日志中收到以下错误.
I get the following error in the Unicorn logs.
I, [2013-05-05T19:15:15.538805 #2357] INFO -- : listening on addr=0.0.0.0:8080 fd=5
F, [2013-05-05T19:15:15.541673 #2357] FATAL -- : error adding listener addr=/home/vagrant/tmp/myapp/sockets/unicorn.sock
/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/lib/unicorn/socket_helper.rb:140:in `initialize': Operation not permitted - "/home/vagrant/tmp/myapp/sockets/unicorn.sock" (Errno::EPERM)
我以 vagrant 用户身份登录并按照 http://recipes.sinatrarb 配置了 unicorn.rb.com/p/deployment/nginx_proxied_to_unicorn
I am logged in as the vagrant user and have configured the unicorn.rb as per http://recipes.sinatrarb.com/p/deployment/nginx_proxied_to_unicorn
@dir = '/home/vagrant/myapp/'
worker_processes 4
working_directory @dir
timeout 30
listen "#{@dir}tmp/sockets/unicorn.sock", :backlog => 64
pid "#{@dir}tmp/pids/unicorn.pid"
stderr_path "#{@dir}log/unicorn.stderr.log"
stdout_path "#{@dir}log/unicorn.stdout.log"
我已经查看了代码,但无法初始化以下内容
I have looked through the code and it fails to initialize the following
Kgio::UNIXServer.new('0.0.0.0:8080')
推荐答案
Unicorn 无法将 .sock 文件存储在 Virtual Box 共享文件夹中,因此您需要做的是从以下内容中修改套接字:
Unicorn can't store a .sock file on a Virtual Box Shared Folder, so what you'll have to do is modify for the socket from this:
listen "#{@dir}tmp/sockets/unicorn.sock", :backlog => 64
为此:
listen "/tmp/sockets/unicorn.sock", :backlog => 64
或 VBox 共享文件夹之外的其他位置.
Or some other location outside of the VBox shared folder.
这篇关于由于 Errno::EPERM,独角兽无法在 Vagrant 盒子上启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!