phusion passenger nginx模块没有拿起我的rails应用程序

时间:2013-03-16 03:14:49

标签: ruby-on-rails nginx passenger ruby-on-rails-2

注意:乘客独立使用我的rails应用程序,因为我需要部署多个rails应用程序,所以我需要passenger-install-nginx-module

OS ubuntu 12.04 LTS 64位

红宝石 REE 1.8.7(通过brightbox repo安装)

Rails 2.3.17

通过 passenger-install-nginx-module

安装Nginx

乘客 3.0.19

Nginx 1.2.6

我的nginx.conf

/opt/nginx/conf/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 {
    passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19;
    passenger_ruby /usr/bin/ruby1.8;

    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  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;
        root   /home/sampath/railsdemoapp/public;
        passenger_enabled on;  

}
}

当我通过sudo / opt / nginx / sbin / nginx启动nginx时,当我访问url时显示403 Forbidden nginx / 1.2.6

1 个答案:

答案 0 :(得分:1)

那是因为Nginx作为www-data或其他一些www用户运行。必须允许他访问'/ home / sampath / railsdemoapp / public'。您需要修改权限。