Log files not being written to (Passenger)

apache, linux, passenger, ruby-on-rails, selinux

Solution

What are the results of "ls -l" on your log file? On Ubuntu I have to make sure that the acl's are correct on the log files. I usually solve that by using

sudo chown -R deploy:deploy /path/to/app

Deploy is the user that passenger runs in.

Problem

Locally, my app runs fine on and writes to its logs. My production server is running CentOS with an Apache server running Passenger. When trying to debug, I noticed my log files were not being written to. First thing I did was chmod 0666 them, and when I found out that didn't work I looked at my apache log. I found this: Rails Error: Unable to access log file. Please ensure that /var/www/vhosts/mysite.com/rails/exp/releases/20091124020342/log/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed. (Note: I am deploying with capistrano) Anyway, I Googled around and found people saying it's an SELinux issue, so I looked on passenger's docs and found this: http://www.modrails.com/documentation/Users%20guide.html#_my_rails_application_8217_s_log_file_is_not_being_written_to which basically says do this: chcon -R -h -t httpd_sys_content_t /path/to/your/rails/app However, when I fill in the proper path I get: Operation not supported. Pretty stumped...any ideas?

Original source