403 Forbidden on Rails app w/ Nginx, Passenger
You can check the path of your passenger installation with
passenger-config --root
and the path of your ruby installation with
which ruby
then compare with the inserted in nginx.conf.
403 Forbidden when using nginx + rails + passenger
You can check the path of your passenger installation with passenger-config --root
, and the path of your ruby installation with which ruby
.
Rails, Passenger, Nginx, I get 403 Forbidden but why?
The error message stated:
directory index of "/var/www/cava/public/" is forbidden
which means that your folder has no index
file, or the file that is to be treated as index.
I am not familiar with Passenger, but if you’ll try to put there index.html
file with content <h1>Hello World</h1>
, it will be likely shown.
The below is not directly related to this problem, but I’ll leave it here for the sake of consistency.
Solution 1
First, determine what user your nginx
runs as
ps ueax|grep 'nginx: worker'|grep -v grep|cut -f1 -d' '
#⇒ www-data
or it might be nobody
, but in your case it’s www-data
according to your conf
file.
Change permissions on /var/www/cava/public
:
sudo chown -R www-data /var/www/cava/public
Retry, it should work now.
Solution 2
Make your nginx
be running as your user. At the very top of conf
change:
- user www-data:
+ user tasos;
The latter one is probably more handy for development.
403 Forbidden - Nginx + Passenger - Rails
You don't need to add passenger_ruby and passenger_ruby in nginx file. You can look into the file /etc/nginx.conf. you can see passenger_root and passenger_ruby having the ini extension just uncomment it. Or there will be line that looks like include /etc/passenger.conf just uncomment it. I think your problem is with passenger wrapper.
nginx + passenger + rails - 403 forbidden error
change
/home/appuser/test_app
to
/home/appuser/test_app/public
Related Topics
How to Get Rid of Non-Ascii Characters in Ruby
Confusion With Atomic Grouping - How It Differs from the Grouping in Regular Expression of Ruby
Ruby - Net/Http - Following Redirects
Nomethoderror When Trying to Invoke Helper Method from Rails Controller
Rails Model, View, Controller, and Helper: What Goes Where
Undefined Method Raise_In_Transactional_Callbacks=' for Activerecord::Base:Class (Nomethoderror)
Counter_Cache With Has_Many :Through
Rails Browser Detection Methods
Passing a Method as a Parameter in Ruby
Using Www:Mechanize to Download a File to Disk Without Loading It All in Memory First
List of Ruby Operators That Can Be Overridden/Implemented
"Rake Assets:Precompile" Gives Punc Error
How to Search a Folder and All of Its Subfolders For Files of a Certain Type