Rails/Nginx: 403 - ruby-on-rails

I'm getting a 403 error on my new rails testing page: removed.com:8080. I installed RVM as root, and everything seems to be running correctly (with my limited knowledge of Ubuntu...).
Here's what my log is reading:
2012/03/26 21:53:33 [error] 11698#0: *2 directory index of "/" is forbidden, client: 150.182.203.216, server: rails.pixelcraftwebdesign.com, request: "GET / HTTP/1.1", host: "pixelcraftwebdesign.com:8080"
What am I doing wrong?! :( I've googled this for about 4 hours...

You're attempting to list directory and it appears that .htaccess/server is restricting this. Go to the actual controller/action as per your routes.rb implementation (e.g. pixelcraftwebdesign.com:8080/home/index if you have home_controller and it has index method inside)

Most likely you don't have the correct permissions set on your home or web directory.
Make sure that you have 755 permissions set throughout your path, to allow the non-privileged user that nginx is running as to traverse your directories and read your files.
Some Linux distros will automatically set restricted permissions on your home directory :
/home/user
As a security precaution to prevent other users from reading your files.

Related

Shopware 6 Staging shows 403 forbidden

I tried to set up a staging of a running Shopware 6 instance.
While I did as the doc of Shopware told, I get a 403 forbidden when I visit the staging like https://staging.xx.de/ I get an 403 error.
The error log says as follows:
Cannot serve directory /home/user/xx/staging/public/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
I copied the .htaccess btw.
As the error log states that there could no matching directory index be found, I reckon you pointed your subdomain to the wrong directory. Please make sure you copied Shopware to a subdirectory and your subdomain points to xx.de/{staging}/public/ and that you properly copied any index file to this this directory.

Caught race condition abuser

The images we uploaded to the site are not showing . When we see the apache error_log file we found the following error,
Caught race condition abuser. attacker: 0, victim: 99 open file owner: 99, open file: /var/www/site_prod/current/public/system/banners/8/original/nGGEDx_Ben_Renick_Banner_-_10K_.png, referer: http://prod.site.com/en/get-help/get-help-shipping-standards
What could be the reason. We have a rails 4 application with capistrano deployment hosted in centos .
All file/folder permissions have been assigned.
I can see you have enabled Symlink Race Condition Protection on your server and installed Apache patch on your server and due to that you are getting this issues, You will have to check your file and folder ownership.
https://documentation.cpanel.net/display/EA/Symlink+Race+Condition+Protection

Error 403. Wamp Server

I have installed wamp server 2.2
I'm using windows 7
When I am online at that time i'm not able to find localhost using WaMp
its giving me some Forbidden Error..You Don't have Access kind of error.
But when I disconnect my internet connection, I can get localhost..PHPmyadmin and all feature of WAMP server.
I tried a lot by changing the Apache httpd .conf to Replace All..."Deny all" to "Allow all"but still, i'm not able to get it online.
Putting server online in contect menu did not help me. If you are using Wamp server 2.2E you will find the lines in your httpd.conf file
# onlineoffline tag - don't remove
Require local
Change them to to
# onlineoffline tag - don't remove
Require all granted
This solved my problem.
Cut and paste:
Error 403 Forbidden with phpmyadmin and WAMP Server
Error 403
-----
Forbidden
You do not have permission to access / on this server.
Edit the Apache configuration file httpd.conf and find the lines:
# onlineoffline tag - don't remove
Order deny, allow
Deny from all
Allow from 127.0.0.1
Change them to:
Order allow, deny
Allow from all
It works.
You can change 127.0.0.1 to ::1 or change Deny from all to Allow from all in the httpd.conf file. I have a blog about this error on Windows 8 at http://www.webtrunghieu.info/site?p=21
You may also have a .htaccess file within your www directory which is causing this error. Be sure to check that.
Go to C:/Windows/System32/drivers/etc/host
find the
"#127.0.0.1 localhost"
line and uncomment it by removing the # sign
It is possible that you get an 'access denied' message even when you are logged in as an administrator.
To work around that, right click on your file editing software and click run as administrator.
You should be able to save the file then
Localhost should work just fine after that.
I tried solutions posted here, but did not work to get wamp 2.2 started on windows 8 machine. This link from wamp server forum solved issue. I needed to change "Listen 80" to "Listen 0.0.0.0:80" in httpd.conf file. This may be an issue specific to my machine but the solution worked like a charm.
just need put your wampserver online
in tray right-click on wamp icon and Put Online

Ruby error on non-ruby site

A friends of mine have a shared hosting with many sites hosted. There is ruby on rails, php, xslt/xml sites using mysql or postgress. Today one of the xslt sites displays this error:
Passenger error #2
An error occurred while trying to access '..../config/environment.rb': Cannot stat '..../config/environment.rb': Permission denied (13)
Apache doesn't have read permissions to that file. Please fix the relevant file permissions.
This is, as I Know, a ruby error (*.rb), but there is no ruby app here! And no any config/ catalogue.
The error log says:
(13)Permission denied: /home/..../.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
The .htaccess file in the htdocs directory is present and have 777 permission for now.
I haven't any idea what does it mean.
I experienced the same problem, Passenger error #2, suddenly and without correlation to any configuration change on my part. I did not add Ruby. I contacted host monster tech support, their level 2 support was baffled.
Confirming that Jaap Haagmans' solution; overriding PassengerEnabled with no from the .htaccess located in public_html works. Thank you kindly Mr.Haagmans.
I think the configuration of either your apache or nginx state that passenger is enabled. Check for a "passenger_enabled on" on nginx or "PassengerEnabled on" on apache in your webserver configuration file. Then disable it on top level or in the virtual host that runs a php website.
You could instead try to put "PassengerEnabled on" in a .htaccess file in the public_html folder (or equivalent, e.g. httpdocs). Also, make sure the .htaccess file is readable (e.g. 644 permissions in Linux), as that's what the error in your error log is saying.
Looks like there are some leaks in the web host's configuration. Passenger (which is like a mod_rails apache extension) is looking to load a particular Rails app's configuration, presumably not yours. If you're doing something important (like an e-commerce site) I'd run far away from the hosting company. Otherwise you'll have to get this resolved through them.

Can't access log files in production

I was trying to run my application and check for some output on the production.log. However Ruby on Rails throws this error.
Apache log
Rails Error: Unable to access log file. Please ensure that /var/www/somefolder/someapp/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.
I have performed the necessary chmod 666 production.log to make it work but I realized that the file is under root access.
So my file permissions are
-rw-rw-rw- 1 root root 20845 2010-03-18 01:18 production.log
I'm not sure how to allow Ruby on Rails to access this file. I'm fairly new to managing a Linux production environment so I request you to excuse my ignorance.
I think you need to change the user and group of production.log to whatever user and group Rails (i.e. Passenger or Mongrel or whatever you are using) runs under.
Okay I just figured it out.
First need to update Apache.conf passenger configurations:
PassengerDefaultUser username
The assign ownership using chown:
chown -R username:username <folder>
I don't know if this is the right way but it worked for me.

Resources