Apache: 403 Forbidden - You don't have permission to access / on this server.

Added by Russell Weed over 3 years ago

I'm having trouble accessing Redmine 2.4.3 under CentOS Apache 2.2.15

I followed the instructions on http://www.redmine.org/projects/redmine/wiki/RedmineInstall and http://www.redmine.org/projects/redmine/wiki/Redmine_on_CentOS_installation_HOWTO#Rename-dispatch-CGI-files-in-redminepublic

I got redmine running on webrick, but when I followed the steps for setting up Apache I only get 403 Forbidden errors. I've tried installing mod_fcgid but haven't had any luck with that either.

Here is my bundle install

[webadmin@server redmine-2.4.3]$ bundle install --without development test
Using rake (10.1.1)
Using i18n (0.6.9)
Using multi_json (1.8.4)
Using activesupport (3.2.16)
Using builder (3.0.0)
Using activemodel (3.2.16)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.3)
Using tilt (1.4.1)
Using sprockets (2.2.2)
Using actionpack (3.2.16)
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (3.2.16)
Using arel (3.0.3)
Using tzinfo (0.3.38)
Using activerecord (3.2.16)
Using activeresource (3.2.16)
Using coderay (1.1.0)
Using fastercsv (1.5.5)
Using rack-ssl (1.3.3)
Using json (1.8.1)
Using rdoc (3.12.2)
Using thor (0.18.1)
Using railties (3.2.16)
Using jquery-rails (2.0.3)
Using mysql2 (0.3.15)
Using net-ldap (0.3.1)
Using ruby-openid (2.3.0)
Using rack-openid (1.4.2)
Using bundler (1.5.3)
Using rails (3.2.16)
Using rmagick (2.13.2)
Your bundle is complete!
Gems in the groups development and test were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

And my script/about:

[webadmin@server redmine-2.4.3]$ script/about

sh: svn: command not found
sh: darcs: command not found
sh: bzr: command not found
Environment:
  Redmine version                2.4.3.stable
  Ruby version                   1.8.7-p352 (2011-06-30) [x86_64-linux]
  Rails version                  3.2.16
  Environment                    production
  Database adapter               Mysql2
SCM:
  Mercurial                      2.2.2
  Git                            1.8.4.4
  Filesystem
Redmine plugins:
  no plugin installed

(NOTE: When I had Redmine running w/ webrick I turned off all non-HG repositories, hence hte above 3 errors)

and the VirtualHost portion of my httpd.conf:

# Redmine (IST)
Listen 3000

<VirtualHost *:80>
    ServerName it.domain.com
    ServerAdmin support@domain.com
    DocumentRoot /home/webadmin/redmine-2.4.3/public
    ErrorLog logs/redmine_error_log

    #If you are using mod_fcgid and are going to upload files larger than
    #131072 bytes you should consider adding the following line
    #that allows to upload files up to 20 mb
    MaxRequestLen 20971520

    <Directory "/home/webadmin/redmine-2.4.3/public">
        Options Indexes ExecCGI FollowSymLinks -MultiViews
        Order allow,deny
        Allow from all
        AllowOverride all
    </Directory>
</VirtualHost>

My Apache error log shows:

[Mon Feb 10 16:44:13 2014] [error] [client 10.1.1.55] (13)Permission denied: access to /favicon.ico denied
[Mon Feb 10 16:44:13 2014] [error] [client 10.1.1.55] (13)Permission denied: access to / denied

I am not a Ruby dev so I know almost nothing about this ecosystem. Any help would be appreciated.

Thanks!

Replies (9)

RE: Apache: 403 Forbidden - You don't have permission to access / on this server. - Added by Russell Weed over 3 years ago

Okay, so I ended up re-installing to a different folder: /<company>/sites/redmine-2.4.3/

The 403 was at the apache level because I couldn't even hit a static HTML file. So now I've got that sorted out, so instead I get a new error message:

Application error
Rails application failed to start properly

Running ./dispatch.fcgi manually yields the following:

[webadmin@dacheat redmine-2.4.3]$ public/dispatch.fcgi
/usr/lib/ruby/gems/1.8/gems/mysql2-0.3.15/lib/mysql2/client.rb:67:in `connect': Access denied for user 'redmine'@'localhost' to database 'redmine_development' (Mysql2::Error)
        from /usr/lib/ruby/gems/1.8/gems/mysql2-0.3.15/lib/mysql2/client.rb:67:in `initialize'

... but as far as I can tell, my environment is production and not development.

Anyone know why the development code is triggering here but not under webrick?

RE: Apache: 403 Forbidden - You don't have permission to access / on this server. - Added by James H over 3 years ago

well...
when you initialize webrick, you usually type in "-e production" in there which gives you a production environment, i believe.

is your database.yml set up correctly

maybe you need:

rails_env=production

RE: Apache: 403 Forbidden - You don't have permission to access / on this server. - Added by Russell Weed over 3 years ago

I've updated my httpd.conf to set:

SetEnv RAILS_ENV production
SetEnv RailsEnv production

However, according to the httpd error log it looks like redmine is still trying to use the development database connection!??

How do I force production to be used? Do I need to set this somewhere in database.yml?

RE: Apache: 403 Forbidden - You don't have permission to access / on this server. - Added by Russell Weed over 3 years ago

Okay, I edited my environment.rb to force production. I think.

Now I get a different error from dispatch.fcgi:

[Tue Feb 11 12:15:39 2014] [notice] SIGHUP received.  Attempting to restart
[Tue Feb 11 12:15:39 2014] [notice] Digest: generating secret for digest authentication ...
[Tue Feb 11 12:15:39 2014] [notice] Digest: done
[Tue Feb 11 12:15:39 2014] [notice] Apache/2.2.15 (Unix) DAV/2 mod_fcgid/2.3.9 configured -- resuming normal operations
/usr/lib/ruby/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require': no such file to load -- fcgi (LoadError)
        from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:236:in `load_dependency'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
        from /usr/lib/ruby/gems/1.8/gems/rack-1.4.5/lib/rack/handler/fastcgi.rb:1
        from /var/www/redmine-2.4.3/public/dispatch.fcgi:20
[Tue Feb 11 12:15:50 2014] [warn] [client 10.1.1.55] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Tue Feb 11 12:15:50 2014] [error] [client 10.1.1.55] Premature end of script headers: dispatch.fcgi

I found this post: http://www.redmine.org/boards/2/topics/31410
which suggested editing dispatch.fcgi, which I did. Still crashes though:

[root@fflit public]# ./dispatch.fcgi
/usr/lib/ruby/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require': no such file to load -- fcgi (LoadError)
        from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:236:in `load_dependency'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
        from ./dispatch.fcgi:6

RE: Apache: 403 Forbidden - You don't have permission to access / on this server. - Added by James H over 3 years ago

not really sure.
dont know anything about fcgi, but sounds like you just need to configure apache.

if you are going to "require fcgi", you will probably require the files first (if you dont already have them)

gem install fcgi

will be along the lines of what you might need for that.

According to your http://www.redmine.org/boards/2/topics/31410 link

I've installed fcgi, fcgi-devel, mod-fcgid and also run "gem install fcgi" with success.

so you probably need to enable those things in apache as well if it hasnt been done already.

Assuming you have already taken a look at:
http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Apache_to_run_Redmine

I'd say it may be easier to get redmine to work with apache first before implementing fcgi.

RE: Apache: 403 Forbidden - You don't have permission to access / on this server. - Added by Russell Weed over 3 years ago

I could never get Redmine working in apache w/o fcgi

I was using that exact guide, however it doesn't really work. The non-fcgi portion references a public/dispatch.cgi, but that file doesn't exist...

RE: Apache: 403 Forbidden - You don't have permission to access / on this server. - Added by Russell Weed over 3 years ago

Nevermind, I abandonded CGI/FCGI and got Passenger working using this guide:

http://www.redmine.org/projects/redmine/wiki/Redmine_on_CentOS_installation_HOWTO#Passenger

My recommendation to anyone who finds this thread is to do the same.

Thanks for all the help James!

RE: Apache: 403 Forbidden - You don't have permission to access / on this server. - Added by James H over 3 years ago

haha good to hear

yeah i was going to suggest that you try using either passenger, thin, or unicorn.
I actually found it easier setting up thin to work with redmine than with JUST apache... which is weird to me since it requires apache...

FCGI/CGI - Added by Mark Anderson about 3 years ago

I realize this is an old issue but I've had trouble with configuration myself and know that any leads are often helpful!

I believe you use one or the other - not both! So in .htaccess you comment in our out whichever one you go with.

Have been running here with FCGI from the beginning without issues after initial setup. Followed the published guides.

You copy the dispatch.fcgi.example to dispatch.fcgi and it should work as-is.

(1-9/9)