乘客未运行Ruby on Rails + Nginx

如何解决乘客未运行Ruby on Rails + Nginx

我的 AWS 实例与我的应用程序运行良好。但是,今天,服务器在没有内存 ram 的情况下停机。然后我运行:

sync; echo 1 > /proc/sys/vm/drop_caches
sudo service Nginx start

之后,ram 内存消耗正常,但应用程序则不行。 我正在 Ubuntu 14 AWS 实例中使用 Ruby 2.2.2 和 Nginx/1.8.0 运行 Rails 4.2.1 网站。

当我访问网站时,出现错误

502 Bad Gateway
Nginx/1.8.0

当我运行 passenger-config restart-app 时,我有

*** ERROR: Phusion Passenger doesn't seem to be running. If you are sure that it
is running,then the causes of this problem Could be one of:

 1. You customized the instance registry directory using Apache's
    PassengerInstanceRegistryDir option,Nginx's
    passenger_instance_registry_dir option,or Phusion Passenger Standalone's
    --instance-registry-dir command line argument. If so,please set the
    environment variable PASSENGER_INSTANCE_REGISTRY_DIR to that directory
    and run this command again.
 2. The instance directory has been removed by an operating system background
    service. Please set a different instance registry directory using Apache's
    PassengerInstanceRegistryDir option,Nginx's passenger_instance_registry_dir
    option,or Phusion Passenger Standalone's --instance-registry-dir command
    line argument.

文件 /var/log/Nginx/error.log我有

2021/06/19 13:21:12 [crit] 26618#0: *48688773 connect() to unix:/tmp/passenger.26EHXct/agents.s/server Failed (2: No such file or directory) while connecting to upstream,client: XXX.XXX.34.163,server: www.XXX.com,request: "GET / HTTP/1.1",upstream: "passenger:unix:/tmp/passenger.26EHXct/agents.s/server:",host: "XXX.com"

我已经尝试过 this solution 并且不起作用。

当我跑步时:passenger-config validate-install 我有

Use <space> to select.
If the menu doesn't display correctly,press '!'

 ‣ ⬢  Passenger itself
   ⬡  Apache

-------------------------------------------------------------------------

 * Checking whether this Passenger install is in PATH... ✓
 * Checking whether there are no other Passenger installations... ✓

Everything looks good. :-)

当我跑步时:sudo passenger-memory-stats 我有

Version: 5.0.10
Date   : 2021-06-19 13:31:40 -0300
------------- Apache processes -------------
*** WARNING: The Apache executable cannot be found.
Please set the APXS2 environment variable to your 'apxs2' executable's filename,or set the HTTPD environment variable to your 'httpd' or 'apache2' executable's filename.


---------- Nginx processes ----------
PID    PPID  VMSize    Private  Name
-------------------------------------
26615  1     230.7 MB  26.3 MB  Nginx: worker process
26616  1     230.4 MB  27.4 MB  Nginx: worker process
26617  1     229.7 MB  25.8 MB  Nginx: worker process
26618  1     233.3 MB  27.4 MB  Nginx: worker process
### Processes: 4
### Total private dirty RSS: 106.78 MB


--- Passenger processes ---

### Processes: 0
### Total private dirty RSS: 0.00 MB

有人知道我该如何解决这个问题吗?

解决方法

当我运行 sudo service nginx restart 时,我没有注意到终端右侧的标志 [fail]

然后,我运行 sudo service nginx status 我收到消息 nginx is not running

运行sudo nginx -t后我收到了消息

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

但是我看到了几个 nginx 进程,然后,我用 sudo kill $(ps aux | grep '[n]ginx' | awk '{print $2}') 杀死了所有 nginx 进程,然后,sudo service nginx start

一切正常。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?