这个是不是项目的路由设置问题....
user root staff;
worker_processes 10;
error_log logs/error.log;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
passenger_root /Users/kaka/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.10;
passenger_ruby /Users/kaka/.rvm/wrappers/ruby-1.9.2-p290/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
root /Users/kaka/Documents/Test/Dom/public; # <--- be sure to point to 'public'!
passenger_enabled on;
index index index.html index.htm;
location ~ ^/assets/ {
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}
location / {
autoindex on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
没看明白。比如改成这样了?
root /Users/kaka/Documents/Test/Dom/public2;
rails 的默认的访问地址是 public,如果要改需要该 rails 配置,这个我没有改过,@huacnlee 应该知道。
server {
listen 80;
server_name localhost;
root /Users/kaka/Documents/Test/Dom/public; # <--- be sure to point to 'public'!
root /Users/kaka/Documents/Test/Dom1/public; # <--- be sure to point to 'public'!
passenger_enabled on;
...
}
别告诉你现在是这样的吧?
@metal 本来是这样的 root /Users/kaka/Documents/Test/Dom/public 我把他修改指定到另外一个项目 root /Users/kaka/Documents/Test/Dom1/public 是修改不是添加...
server {
listen 80;
server_name localhost;
root /Users/kaka/Documents/Test/Dom1/public; # <--- be sure to point to 'public'!
passenger_enabled on;
...
}
修改 root 到另外一个项目..
我一般到把下面这段去掉了 ··· index index index.html index.htm;
location ~ ^/assets/ { expires 1y; add_header Cache-Control public;
add_header ETag ""; break; }
location / { autoindex on; }
error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } ··· 还有我加了一句·rails_env development;·