3
votes

Hello i setup my first webserver for rails but when i copy rails app and run nginx server, im getting 403 error in browser and error.log says that directory index is forbidden.. the error is solved when i create index.html in public folder in rails app but why rails is not started ? (server was compilled with passenger) and bundle install inside rails app works. thank you.

/opt/nginx/conf/nginx.conf

http {
    passenger_root /home/lukas/.rvm/gems/ruby-1.9.3-p448@rails3/gems/passenger-4.0.14;
    passenger_ruby /home/lukas/.rvm/wrappers/ruby-1.9.3-p448@rails3/ruby;
    include /opt/nginx/conf.d/*.conf; 
...
}

/opt/nginx/conf.d/default.conf

server {
 listen *:80;
 server_name hostname.org www.hostname.org

 passenger_enabled on;
 rails_env production;
 root /var/www/default/public;

 error_log /opt/nginx/logs/vhosts/default/error.log;
 access_log /opt/nginx/logs/vhosts/default/access.log combined;
}

folder permissions

lukas@webserver:/var/www$ ls -al
drwxrwxr-x 13 lukas lukas 4096 Aug 30 12:26 default

im starting nginx with

sudo /etc/nginx/sbin/nginx

/opt/nginx/logs/vhosts/default/error.log

2013/08/30 12:48:08 [error] 32643#0: *1 directory index of "/var/www/default/public/" is forbidden, client: xx.xx.xx.xx, server: ...
1

1 Answers

0
votes

Nginx needs to have read permissions for the file as well as execute permissions for every hierarchical parent directory of the file to chdir to it and also Sometimes, the index directive does not contain the desired directory index.