Passenger not reading .htaccess from Document Root specified - ruby-on-rails-3

<VirtualHost *:80>
DocumentRoot /home/fred/AptanaStudioWorkspaceSS/railsapproot/public
ServerName 3strides.localhost
<Directory /home/fred/AptanaStudioWorkspaceSS/railsapproot/public>
AllowOverride all
Options Indexes -MultiViews
</Directory>
</VirtualHost>
I get this apache error
(13)Permission denied: /home/fred/AptanaStudioWorkspaceSS/railsapproot/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
Apache did not visit railsapproot/public to read the .htaccess file. I looked for it in railsapproot
When I change .htaccess permissions to 777 and copy to railsapproot I get similar errors.

Usually, I get this when the x-permission is missing on some subdirectory. Can you check that?

Related

Getting error .htaccess: <IfModule not allowed here

I am setting up a local site on my mac Mavericks. When I do it I get a 500 error. The logs show me the error in the ".htaccess: IfModule not allowed here". From everything I have seen it says to put AllowOverride ALL to fix this issue but it is not working for me. I know I am just missing something simple so any suggestions would be appreciated.
Thanks
Below is my conf file for that vhost.
<VirtualHost *:80>
DocumentRoot "/Users/Swany/Sites/test/public"
ServerName test.dev
ErrorLog "/private/var/log/apache2/test.dev-error_log"
CustomLog "/private/var/log/apache2/test.dev-access_log" common
<Directory "/Users/Swany/code/www/test/public">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Looks like I also needed to go into the default conf file /etc/apache2/httpd.conf and also switch AlloOveride All and Require all granted and it started to work. I thought the vhost conf file would override it but apparently not.

Creating Multiple Virtual Hosts on xampp apache server v-3.2.1 on windows-10

I am tried to create Multiple Virtual Hosts on my Windows 10, 64-bit, XAMPP 3.2.1
I did the following:
1- C:\Windows\System32\drivers\etc\hosts
I have added these line at the bottom of the hosts file:
127.0.0.1 smc
127.0.0.1 ocms
2- D:\xampp\apache\conf\httpd.conf
Virtual hosts is already is enabled see the following:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
3- D:\xampp\apache\conf\extra\httpd-vhosts.conf
Here i have added the following code block on httpd-vhosts.conf file:
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerName smc
DocumentRoot "D:/vhosts/smc"
SetEnv APPLICATION_ENV "development"
<Directory "D:/vhosts/smc/">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName ocms
DocumentRoot "D:/vhosts/ocms/"
SetEnv APPLICATION_ENV "development"
<Directory "D:/vhosts/ocms">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Finally i have put both my directories in my D:/vhosts/ folder:
D:/vhosts/ocms
D:/vhosts/smc
After i have restarted my apache server and test the url like:
http://ocms
Or
http://smc
It returns the following error:
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
ocms
Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8
I have googled it too many times for last three to four days and also followed some other posts on stackoverflow i.e. how to create virtual host on XAMPP but with no luck. Please let me know what i am missing.
Thanks
Ok i have done it. i had to put all my directories under the htdocs folder like this.
structure should be:
D:\xampp\htdocs
D:\xampp\htdocs\test\smc
D:\xampp\htdocs\test\ocms
Thank you all for your precious time
Your initial settings works fine for me.
I think your problem was that the index was missing.
This line will force Apache to accept only index.php file as entry point:
DirectoryIndex index.php
However, if your entry point has a different name or extension you get the error:
You don't have permission to access the requested directory. There is either no index document or the directory is read-protecte

Breaking .htaccess rule

is there anyway to defy .htaccess? I mean to break what the rule written in the .htaccess file.
I have a directory, and I don't want others to browse it. So I created .htaccess file and wrote this
Deny from all
Is there anyway people can break it?
Nope this is radical. Nobody can access it. It is safe and commonly used. The deny is made server side, so nobody can try to bypass it.
.htaccess files are as secure as Apache allows you to.
See for example, assuming your .htaccess file is located in /var/www/foo:
<Directory />
Allow From All
AllowOverride All # allow .htaccess files globally
</Directory>
<VirtualHost *:80>
ServerName www.foo.com
DocumentRoot /var/www/foo # impossible to access, thanks to .htaccess
</VirtualHost>
<VirtualHost *:80>
ServerName www.bar.com
DocumentRoot /var/www/foo # same directory as above
<Directory /var/www/foo>
AllowOverride None # woops .htaccess will not be read, files can be accessed from this vhost
</Directory>
</VirtualHost>
Therefore there is no guarantee ever that your files are securely protected, as long as you don't know (and don't understand) how your apache installation is configured.

virtualhost not using htaccess on fedora 19

I've recently switched over to a fedora 19 cloud server service and got most things squared away except for htaccess. Am I doing this wrong or missing something?
This is what i have updated in my httpd.conf file
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
And Here is my VirtualHost telling it what folder structure and which file to use for htaccess
<VirtualHost *:80>
DocumentRoot /var/www/vhosts/domain.com/httpdocs
ServerName www.domain.com
ServerAlias www.domain.com
<Directory /var/www/vhosts/domain.com/vhosts/>
AllowOverride All
Order allow,deny
allow from all
</Directory>
AccessFileName .htaccess
</VirtualHost>
I've thrown random junk into my htaccess and I do not get a 500 error so I know its not getting read.
Your document root is:
/var/www/vhosts/domain.com/httpdocs
And your <Directory> container is for:
/var/www/vhosts/domain.com/vhosts/
Are those supposed to be different? If your htaccess file is in the httpdocs directory, then that directory doesn't have the AllowOverride All associated with it. If your htaccess file is in the vhosts directory, then it's not being accessed when you go to your website.

What is wrong with this apache virtualhost directive?

I'm getting 403 forbidden errors with this virtualhost directory in apache 2.2. Can anyone help, please?
<VirtualHost *:80>
ServerName www.xyz.com
ServerAlias xyz.com
DocumentRoot "/home/bruce/projects/links/www"
<Directory />
AllowOverride None
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html index.htm index.jsp index.php
</VirtualHost>
Thanks!
EDIT error in log is
(13)Permission denied: access to / denied
If i'm not wrong you have indicated the root directory of you file system in < Directory>
It should be:
<VirtualHost *:80>
ServerName www.xyz.com
ServerAlias xyz.com
DocumentRoot "/home/bruce/projects/links/www"
<Directory /home/bruce/projects/links/www>
...
Gah. It ended up being that I was indeed forbidden from accessing that page. I am using a new virtual server provider, and they have set up my /home account as readable only by me. As a result, the user running apache was unable to view the files. I've changed the permissions on my home directory to be more lenient and now everything works as expected.