NGINX + Passenger 404 143错误

时间:2016-11-15 04:33:48

标签: ruby-on-rails nginx passenger

我的项目位于:tenklakes.northcentralus.cloudapp.azure.com/ 它正确地路由到我的路由文件中定义的根,但如果我尝试去/ lakeaddresses我收到NGINX 404错误,它甚至没有进入我的ruby项目。我非常困惑,因为我的error.log文件没有显示/ lakeaddresses请求的错误,但是在access.log文件中很明显有一个GET请求,它只是返回一个404。

我应该在某处寻找补救措施吗?

/var/log/nginx/access.log

xxx.xx.xx.xxx - - [14/Nov/2016:22:18:39 +0000] "GET /lakeaddresses HTTP/1.1" 404 143 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0"

/etc/nginx/nginx.conf

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
    gzip on;
    gzip_disable "msie6";

    include /etc/nginx/passenger.conf;
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

/etc/nginx/passenger.conf

passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/bin/passenger_free_ruby;

的/ etc / nginx的/位点可用/默认

server {
    listen 80;
    server_name tenklakes.northcentralus.cloudapp.azure.com;
    #passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
    passenger_enabled on;
    passenger_app_env production;
    root /home/garrett/lakemag/public;

/var/log/nginx/error.log

[ 2016-11-14 22:04:26.4994 39317/7f6fa3a9b700 age/Ust/UstRouterMain.cpp:422 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2016-11-14 22:04:26.4995 39317/7f6fa9a6d7c0 age/Ust/UstRouterMain.cpp:492 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2016-11-14 22:04:26.4995 39317/7f6fa3a9b700 Ser/Server.h:464 ]: [UstRouter] Shutdown finished
[ 2016-11-14 22:04:26.4995 39317/7f6fa329a700 Ser/Server.h:817 ]: [UstRouterApiServer] Freed 0 spare client objects
[ 2016-11-14 22:04:26.4995 39317/7f6fa329a700 Ser/Server.h:464 ]: [UstRouterApiServer] Shutdown finished
[ 2016-11-14 22:04:26.4997 39317/7f6fa9a6d7c0 age/Ust/UstRouterMain.cpp:523 ]: Passenger UstRouter shutdown finished
[ 2016-11-14 22:04:26.5033 39364/7f8d0dcb07c0 age/Cor/CoreMain.cpp:982 ]: Starting Passenger core...
[ 2016-11-14 22:04:26.5034 39364/7f8d0dcb07c0 age/Cor/CoreMain.cpp:235 ]: Passenger core running in multi-application mode.
[ 2016-11-14 22:04:26.5048 39364/7f8d0dcb07c0 age/Cor/CoreMain.cpp:732 ]: Passenger core online, PID 39364
[ 2016-11-14 22:04:26.5094 39370/7fdc4e25b7c0 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2016-11-14 22:04:26.5099 39370/7fdc4e25b7c0 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 39370
[ 2016-11-14 22:04:26.5196 39312/7f7b15ff27c0 age/Cor/CoreMain.cpp:967 ]: Passenger core shutdown finished
App 39797 stdout: 
App 39885 stdout: 

/lakemag/log/production.log

I, [2016-11-15T14:32:00.454994 #39885]  INFO -- : [791e0467-658b-4311-8a93-3fd90d1f9a4b] Started GET "/" for 173.25.246.47 at 2016-11-15 14:32:00 +0000
I, [2016-11-15T14:32:00.458445 #39885]  INFO -- : [791e0467-658b-4311-8a93-3fd90d1f9a4b] Processing by MapController#index as HTML
I, [2016-11-15T14:32:00.459087 #39885]  INFO -- : [791e0467-658b-4311-8a93-3fd90d1f9a4b]   Rendering map/index.html.erb within layouts/application
I, [2016-11-15T14:32:00.459226 #39885]  INFO -- : [791e0467-658b-4311-8a93-3fd90d1f9a4b]   Rendered map/index.html.erb within layouts/application (0.0ms)
I, [2016-11-15T14:32:00.459888 #39885]  INFO -- : [791e0467-658b-4311-8a93-3fd90d1f9a4b] Completed 200 OK in 1ms (Views: 1.0ms | ActiveRecord: 0.0ms)

的routes.rb

Rails.application.routes.draw do

get '/lakeaddresses' => 'lakeaddresses#index'
root 'map#index'
end

1 个答案:

答案 0 :(得分:0)

在我的nginx.conf文件中有一行:

try_files $uri $uri/ =404;

删除该行解决了这个问题。似乎nginx有自动加载的配置问题。