我目前想在我的 Rails 设置中使用 NGINX。我已将配置文件放在目录中RAILS_ROOT/config/nginx
。这是我放置命名development.conf
的配置文件和mime.types
-file。
我想将我的日志放在 -RAILS_ROOT/log
目录中。
这是我的development.conf
:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
# main access log
access_log log/nginx.access.log;
# main error log
error_log log/nginx.error.log debug;
sendfile on;
keepalive_timeout 65;
server {
listen 9001; #omg!
server_name local.woman.dk;
rewrite ^/(.*)/$ /$1 last;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_max_temp_file_size 0;
location / {
ssi on;
proxy_pass http://127.0.0.1:3000;
}
}
}
我使用以下命令从我的 RAILS_ROOT 启动 NGINX:
nginx -p . -c config/nginx/development.conf
我收到以下错误:
nginx: [alert] could not open error log file: open() "./logs/error.log" failed (2: No such file or directory)
我的版本是这样的:
[(master)]=> nginx -v
nginx version: nginx/1.2.4
我做错什么了吗?