1

Here is the error.log of nginx server running on ubuntu 12.04.

2014/03/17 12:47:17 [error] 7939#0: *1 open() "/opt/nginx/html/mkl/authentify/signin" failed (2: No such file or directory), client: xxx.xxx.228.66, server: xxx.xxx.109.181, request: "GET /mkl/authentify/signin HTTP/1.1", host: "xxx.xxx.109.181"

In /opt/nginx/conf/nginx.conf, it is configured as following (the only server block in conf):

  server {
    listen 80;
    server_name xxx.xxx.109.181;
    root /ebs/www/;
    passenger_enabled on;
    rails_env production;
    passenger_base_uri /mkl;
    .....
  }

The root of nginx server is pointing to /ebs/www/. However the nginx is accessing the /opt/nginx and throws out no such file error. What causes the problem? Thanks.

The nginx was installed with passenger-install-nginx-module after gem passenger was installed.

user938363
  • 9,990
  • 38
  • 137
  • 303
  • check if your config file is read from correct location. try running `nginx -t` – Raj Mar 21 '14 at 10:07
  • Just came back from a trip & sorry for slow response. nginx -t returns: The program 'nginx' can be found in the following packages: * nginx-extras * nginx-full * nginx-light * nginx-naxsi – user938363 Mar 26 '14 at 22:48

2 Answers2

2

Correctly root is your public order from your application:

server {
  listen 80;
  server_name xxx.xxx.109.181;
  root /ebs/www/YOUR_APPLICATION/current/public;
  # e.g. root /var/www/vhosts/example.com/httpdocs/example/current/public;
  passenger_enabled on;
  rails_env production;
  passenger_base_uri /mkl;
  .....
}
Exsemt
  • 1,048
  • 10
  • 22
1

The problem is fixed after adding one more server {} block after the first (only) server block in nginx.conf. In previous version (probably 1.4.x), there were 2 server blocks in nginx.conf. In current version, there is only one server {} block.

More reading about the solution can be found at Why is nginx responding to any domain name? & https://serverfault.com/questions/416064/rails-application-only-showing-nginx-default-page

Community
  • 1
  • 1
user938363
  • 9,990
  • 38
  • 137
  • 303
  • Adding another server{} block shouldn't matter. If a root configured in the only server block, it should be used for all requests. I suspect what you observe is a passenger problem. It would be cool if you'll check the same configuration (minus passenger-related directives) with vanilla nginx from nginx.org to make sure it's indeed passenger problem (and not some obscure bug in nginx). – Maxim Dounin Jul 04 '14 at 23:23