Nginx路由到<domain> /index.html/index.html </domain>

时间:2012-10-06 23:37:37

标签: ruby-on-rails-3 nginx centos web-deployment

我最近使用Phusion Passenger设置了Nginx,目的是将rails应用程序部署到子uri。 rails应用程序根据需要进行部署,但是,当我导航到projectvisionapps.com时,我注意到nginx将我发送到projectvisionapps.com/index.html/,这会引发404.如果我手动输入projectvisionapps.com/index.html ,nginx提供正确的页面。

任何线索或建议?

检查nginx错误日志,我看到:

2012/10/06 19:23:05 [error] 20782#0: *21 "/var/www/vhosts/projectvisionapps.com/httpdocs/index.html/index.html" is not found (20: Not a directory), client: 50.1.57.140, server: , request: "GET /index.html/ HTTP/1.1", host: "www.projectvisionapps.com"

我的nginx.conf如下:

#user  nobody;
worker_processes  1;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
worker_connections  1024;
}


http {
index index.html;

passenger_root /home/samudzi/.rvm/gems/ruby-1.9.3-p194@global/gems/passenger-3.0.17;
passenger_ruby /home/samudzi/.rvm/wrappers/ruby-1.9.3-p194/ruby;

include       mime.types;
default_type  application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

access_log  logs/access.log;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

gzip  on;

include /opt/nginx/conf/conf.d/*.conf;


}

我包含的.conf文件是:

server {
listen 74.208.46.76:80;
server_name projectvisionapps.com;
#root /var/www/vhosts/projectvisionapps.com/httpdocs;

#try_files $uri.html $uri $uri/ @notfound;

location / {
  index index.html;
  root /var/www/vhosts/projectvisionapps.com/httpdocs;
  try_files $uri $uri/ /index.html;
}
}

和rails应用程序(完美运行)

server {
listen 74.208.46.76:80;
#server_name projectvisionapps.com;
root /var/www/vhosts/projectvisionapps.com/httpdocs;
passenger_enabled on;
passenger_base_uri /dev;
rails_spawn_method smart;
rails_env development;
gzip on;
}

感谢您提出任何建议或建议!

0 个答案:

没有答案
相关问题