0

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

操作系统 ubuntu 12.04 LTS 64 位

Ruby REE 1.8.7(通过 Brightbox 存储库安装)

导轨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

4

1 回答 1

1

那是因为 Nginx 以 www-data 或其他一些 www 用户身份运行。必须允许他访问“/home/sampath/railsdemoapp/public”。您需要修复您的权限。

于 2013-03-16T19:57:15.293 回答