是这样的,我按照配置,给出了如下的 nginx 的配置文件,
events {
worker_connections 1024;
}
http {
passenger_root /home/sdy/.rvm/gems/ruby-2.0.0-p643@rails4/gems/passenger-5.0.15;
passenger_ruby /home/sdy/.rvm/gems/ruby-2.0.0-p643@rails4/wrappers/ruby;
include mime.types;
default_type application/octet-stream;
#access_log logs/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 8800;
server_name 127.0.0.1;
root /home/sdy/rails_project/saler/public;
passenger_intercept_errors on;
passenger_friendly_error_pages off;
passenger_enabled on;
error_page 404 /404.html;
}
}
查看 nginx 的日志显示为:
2015/08/09 18:15:02 [error] 12945#0: *3 open() "/home/sdy/rails_project/saler/public/abc.html" failed (2: No such file or directory), client: 127.0.0.1, server: 127.0.0.1, request: "GET /abc.html HTTP/1.1", host: "127.0.0.1:8800"
2015/08/09 18:15:02 [error] 12945#0: *3 open() "/home/sdy/rails_project/saler/public/404.html" failed (2: No such file or directory), client: 127.0.0.1, server: 127.0.0.1, request: "GET /abc.html HTTP/1.1", host: "127.0.0.1:8800"
我的 public 目录当中是存在 abc.html 以及 404.html 的,可以判断 nginx 访问 public 目录没有找到 abc.html,随后按照设置在该目录寻找 404.html 但是都没有找到
附注:rails 使用的是 4.2,我猜是不是和 asset 之类的有关,但是 asset 这不是我不是很懂。