I get 403 error using passenger for rails in apache

I already installed the necessary tools and followed several textbooks that tried to answer the passenger.

I can access static files in a shared folder (public / 500.html or 422.hml). Yesterday I entered through a prism and discovered some passenger errors. But after some time, the hosting restarted the service, and since then I have not been able to access the rails application again.

link

link

link

Here are some of the links I used to configure the server. I also read that this might be a resolution problem; I checked it, but I'm not sure if this is good.

+7
ruby-on-rails apache passenger vhosts
source share
4 answers

The answer was that the passenger gave me 403 because I had to set the environment variable "RackEnv" in the apache configuration for "development" (in my case).

+1
source share

First of all, check your error log. By default, it is placed in /var/log/apache2/ .

If you have a client denied by server configuration problem, check your site's conf file in /etc/apache2/sites-available/your-site.conf . It must comply with the Phusion Passenger User Guide . Take a look at Require all granted .

 <Directory "/home/user/folder"> Require all granted Options FollowSymLinks # This relaxes Apache security settings. AllowOverride None # MultiViews must be turned off. Order allow,deny Allow from all </Directory> 
+15
source share

Ok for me it meant i ran rails 2.3 and used phusion passenger 5.x

Apparently, 5.x does not work with 2.2 at all and requires 2.3 to be copied in the config.ru file in order for it to use the rack for the backend.

Example config.ru file for version 2.3:

 # Rack Dispatcher # Require your environment file to bootstrap Rails require File.dirname(__FILE__) + '/config/environment' # Dispatch the request run ActionController::Dispatcher.new 

I could not understand why no spells seemed to work, it was like the Passenger ignored my rail application.

In my / var / log / apache 2 / error.log file, I had the following:

[Mon May 11, 15: 47: 00.397891 2015] [autoindex: error] [pid 17490: tid 3058694976] [client 216.49.181.251:49248] AH01276: Unable to specify the directory / home / x / y / railsapp / public /: Not Found IndexIndex directories (index.html, index.cgi, index.pl, index.php, index.xhtml, index.htm) and server index directories using the Options, referer directive: https://www.google. com /

What baffled me, apparently, meant that "the passenger is not working on this virtual host."

If I created the public / index.html file, apache did a great job of this, so the problem was not resolved.

I also saw this, which meant that the passenger started normally:

[2015-05-11 18: 23: 53.9594 4964 / b7415700 agent / Watchdog / Main.cpp: 728]: All Phusion Passenger agents are running!

See also https://www.phusionpassenger.com/documentation/Users%20guide%20Apache%204.0.html#_i_get_a_403_forbidden_error

So, basically with the 5.x passenger (the release notes say that rails 2.2 is not supported, 2.3 is only supported if you create the config.ru file in the root of your rails application. It works with older versions of the rack, such as rails 2.3 require, just remove your new pearl and install 1.1.6, or do not remove, if any, prefabricated racks GL!

Just like a note, this message is:

[Mon May 11 18: 25: 10.235574 2015] [core: alert] [pid 5263: tid 3017780032] [client 127.0.0.1/106737-03/home/rdp/dev/prod_flds/public/.htaccess: Invalid "RewriteEngine" command , possibly with an error or determined by a module not included in the server configuration

means "delete your public /.htaccess file, which the passenger usually does not need"

+4
source share

I also had a 403 error using passenger for rails in apache on my Mac OS 10.9 (Unix-like system). Here are some suggestions:

  • You can check the apache log directory and see what happened. Directory: / var / log / apache2 / error_log .
  • Problem: Access denied: access to / denied (path to file system 'path_apache_access), because search permissions are missing on the path component .

    Check 'path_apache_access' with the CLI: ls -ld 'path_apache_access' and use chmod + x to change the privilege of the path.

    Also, pay attention to this: Httpd Wiki - (13) Permission denied - .

  • Problem: configuration error: authentication failed. AuthType is not installed! .

    Problem: The client refused the server configuration .

    Go to / etc / apache 2 / httpd.conf and look at the <Directory> tag.

    Check the Apache version using the CLI: apachectl -v , if Apache <2.4, DO NOT uncomment "Require all provided."

     <Directory "rails_app_directory/public"> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews # Uncomment this if you're on Apache >= 2.4: # Require all granted Options FollowSymLinks Order allow,deny Allow from all </Directory> 
+2
source share

All Articles