问题描述
我不知道unicorn.rb文件出了什么问题.我的unicorn.rb配置是
I dont know what’s wrong with the unicorn.rb file. my unicorn.rb config is
APP_PATH = "/var/www/demo"
working_directory APP_PATH
stderr_path APP_PATH + "/log/unicorn.stderr.log"
stdout_path APP_PATH + "/log/unicorn.stderr.log"
pid APP_PATH + "/tmp/pid/unicorn.pid"
运行nginx成功.
running nginx successful.
sudo servier nginx start
sudo unicorn -c /var/www/demo/config/unicorn.rb -D
推荐答案
套接字是nginx和unicorn用作它们之间所有通信的通道的文件".您在哪里定义它?在我们的独角兽配置中,通常会有这样的一行:
The socket is the "file" that nginx and unicorn use as a channel for all communication between them. Where have you defined it? In our unicorn configs, we usually have a line like this:
listen APP_PATH + "/tmp/pid/.unicorn.sock
然后,在您的nginx.conf中,您需要告诉nginx有关此套接字的信息,例如:
Then, in your nginx.conf, you need to tell nginx about this socket, e.g.:
upstream unicorn {
server unix:/var/www/demo/tmp/pid/.unicorn.sock fail_timeout=0;
}
location / {
root /var/www/demo/current/public ;
try_files $uri @unicorns;
}
location @unicorns {
proxy_pass http://unicorn;
}
在此配置文件中,第一部分定义了nginx如何到达独角兽.第二个实际上将请求路由到抽象位置"@unicorns",该位置依次在最后一节中定义.这样,如果您正在进行更复杂的Nginx路由,则可以重复使用@unicorns速记.
In this config file, the first section defines how nginx can reach unicorn. The second one actually routes requests to an abstract location "@unicorns" which, in turn, is defined in the last section. This way you can reuse the @unicorns shorthand if your have more complex nginx routing going on.
这篇关于无法启动独角兽,主服务器无法启动,请查看stderr日志以获取详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!