这个问题被问过太多次了。我花了几个小时浏览stackoverflow上的所有帖子,但到目前为止还没有运气。尝试访问我的 rails 应用程序时总是得到 403 Forbidden。使用新生成的空应用程序对此进行测试。
/var/www 中的所有文件都归 www-data 所有。我已在代码的完整路径上将权限设置为 755。当我将 index.html 添加到公共目录时,它会显示出来,但我无法让应用程序运行。
这是启用的站点中的配置
server {
listen 80;
root /var/www/default/public;
server_name s.dev
passenger_enabled on;
rails_env development;
}
nginx.conf
user www-data;
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_vary off;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/rss+xml application/atom+xml text/javascript application/javascript application/json text/mathml;
gzip_min_length 1000;
gzip_disable "MSIE [1-6]\.";
server_names_hash_bucket_size 64;
types_hash_max_size 2048;
types_hash_bucket_size 64;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
乘客配置文件
passenger_root /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.17;
passenger_ruby /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby;
passenger_max_pool_size 6;
passenger_spawn_method smart-lv2;
passenger_use_global_queue on;
passenger_buffer_response on;
passenger_min_instances 1;
passenger_max_instances_per_app 0;
passenger_pool_idle_time 300;
passenger_max_requests 0;
任何关于我可以尝试的建议将不胜感激!
谢谢
更多信息:
乘客配置--root
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.17
哪个红宝石
/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby
这是错误
2013/09/11 16:03:00 [错误] 30400#0: *3 目录索引“/var/www/default/public/”被禁止,客户端:145.33.44.33,服务器:s.dev,请求: “GET / HTTP/1.1”,主机:“s.dev”
乘客记忆统计
Version: 4.0.17
Date : 2013-09-11 16:24:16 -0400
------- Apache processes --------
### Processes: 0
### Total private dirty RSS: 0.00 MB
---------- Nginx processes ----------
PID PPID VMSize Private Name
-------------------------------------
32226 1 38.8 MB 0.2 MB nginx: master process /opt/nginx-1.5.4/sbin/nginx
32227 32226 39.2 MB 0.6 MB nginx: worker process
32228 32226 39.2 MB 0.5 MB nginx: worker process
### Processes: 3
### Total private dirty RSS: 1.25 MB
----- Passenger processes -----
PID VMSize Private Name
-------------------------------
32200 216.2 MB 0.3 MB PassengerWatchdog
32205 489.6 MB 0.3 MB PassengerHelperAgent
32220 223.6 MB 0.8 MB PassengerLoggingAgent
### Processes: 3
### Total private dirty RSS: 1.40 MB
运行“乘客启动”时,我也能够成功运行应用程序