【问题标题】:Safari can't connect to the server (nginx,unicorn,ubuntu,rails,mysql)Safari 无法连接到服务器(nginx、unicorn、ubuntu、rails、mysql)
【发布时间】:2015-09-29 07:03:29
【问题描述】:

我正在尝试打开我的网页http://moneytree.space/catalogs/traders,但我得到了:

unicorn 和 nginx 正在运行。我的工作目录是/home/zhall/zoulfia

   root@moneytree:/home/zhall/zoulfia# rails s -e production
      => Booting Unicorn
      => Rails 4.2.0 application starting in production on        

       http://localhost:3000

      => Run `rails server -h` for more startup options

      => Ctrl-C to shutdown server

当我输入时:

在我的 /etc/nginx/sites-avalable/default 文件中,我得到了:

我需要将 server_name 更改为 localhost 吗?我是所有这些配置的新手,任何帮助将不胜感激。谢谢你。 也许我的服务器因为出现一些错误而关闭。我不知道在哪里追捕他们。我的日志文件是空的:(

我检查 nginx 配置:

 sudo nginx -t
 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
 nginx: configuration file /etc/nginx/nginx.conf test is successful

当我启动 webrick 时:

Zoulfias-iMac:zoulfia zoulfiahall$ rails s -e production
=> Booting WEBrick
=> Rails 4.2.0 application starting in production on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-07-10 17:08:38] INFO  WEBrick 1.3.1
[2015-07-10 17:08:38] INFO  ruby 2.2.0 (2014-12-25) [x86_64-darwin13]
[2015-07-10 17:08:38] INFO  WEBrick::HTTPServer#start: pid=18631 port=3000

启动我的应用程序没有问题。

当 Unicorn 服务器启动时,我得到:

 root@moneytree:/home/zhall/zoulfia# rails s -p80 -e production
 => Booting Unicorn
 => Rails 4.2.0 application starting in production on http://localhost:80
 => Run `rails server -h` for more startup options
 => Ctrl-C to shutdown server
root@moneytree:/home/zhall/zoulfia#    ------> this line should not be here!

如何设置应用程序日志记录以查看错误?

【问题讨论】:

  • 我在你的netstat 结果中看不到nginx,如果我尝试telnet 到你服务器上的端口80,我会得到Connection refused
  • 感谢您的回复。这是什么意思?我需要做什么来纠正它。可能导致这种情况发生的错误有哪些?
  • 我认为你的 nginx 配置有问题。 See this question。您可能还想尝试在Server Fault 上发帖。

标签: nginx unicorn server-name


【解决方案1】:

我做了一件很傻的事。我检查了我的 /home/zhall/zoulfia/config 文件,发现 unicorn.rb 文件在那里。我删除了文件并再次运行服务器。现在可以了。有些事情告诉我这还没有结束……我会带着其他问题回来。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-03-25
    • 2020-03-18
    • 2021-05-13
    • 2018-09-27
    • 1970-01-01
    • 1970-01-01
    • 2015-03-28
    • 2013-08-15
    相关资源
    最近更新 更多