ruby与nginxconfiguration文件的轨道上

我正试图让我的应用程序的nginx上传模块工作。 我已经修改了nginx.conf文件中的服务器块,当我尝试访问我的网站时,会抛出403 Forbidden错误。 日志说,铁路公共目录不能被访问。

http { passenger_root /opt/passenger-3.0.0; passenger_ruby /usr/bin/ruby1.8; include mime.types; default_type application/octet-stream; sendfile on; #tcp_nopush on; client_max_body_size 30M; #allow large uploads #keepalive_timeout 0; #gzip on; server { listen 80; server_name url.com; root /path/current/public; # Match this location for the upload module location /images/fast_upload { # pass request body to here upload_pass @fast_upload_endpoint; upload_store /path/shared/uploads_tmp 1; # set permissions on the uploaded files upload_store_access user:rw group:rw all:r; # Set specified fields in request body # this puts the original filename, new path+filename and content type in the$ upload_set_form_field upload[fast_asset][original_name] "$upload_file_name"; upload_set_form_field upload[fast_asset][content_type] "$upload_content_type$ upload_set_form_field upload[fast_asset][filepath] "$upload_tmp_path"; upload_pass_form_field "^image_id$|^authenticity_token$|^format$"; upload_cleanup 400 404 499 500-505; } location @fast_upload_endpoint { passenger_enabled on; rails_env production; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } } 

当我将“passenger_enabled”移出位置块时,它工作正常。 然而,它看起来不像nginx在.conf文件中使用该configuration上传文件。

 location @fast_upload_endpoint { passenger_enabled on; rails_env production; } location / { rails_env production; passenger_enabled on; } 

我添加了第二个位置块,现在看起来好了。