Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: [SOLVED] Apache looking in wrong dir for htaccess?

  1. #1
    Join Date
    Nov 2005
    Beans
    40
    Distro
    Ubuntu 6.06

    [SOLVED] Apache looking in wrong dir for htaccess?

    I'm having trouble setting up a virtual host in apache.
    I'm getting a 403 error when I try to go to the site.
    DocumentRoot should be /home/bennybobw/www/franksmith/drupal but it looks like apache is looking in /home/bennybobw/www for my .htaccess file.

    Here's my site config file:

    Code:
    <VirtualHost *>
    	ServerAlias franksmith
    	ServerAdmin webmaster@localhost
    	ServerName franksmith
    	DocumentRoot /home/bennybobw/www/franksmith/drupal
    	<Directory /home/bennybobw/www/franksmith/drupal>
    		Options Indexes FollowSymLinks MultiViews
    		AllowOverride All
    		Order allow,deny
    		allow from all
    	</Directory>
    
    	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    	<Directory "/usr/lib/cgi-bin">
    		AllowOverride None
    		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    		Order allow,deny
    		Allow from all
    	</Directory>
    
    	ErrorLog /var/log/apache2/franksmith-error.log
    
    	# Possible values include: debug, info, notice, warn, error, crit,
    	# alert, emerg.
    	LogLevel warn
    
    	CustomLog /var/log/apache2/franksmith-access.log combined
    	ServerSignature On
    
    </VirtualHost>
    And /var/log/apache2/franksmith-error.log

    [Sat May 17 15:12:49 2008] [crit] [client 127.0.0.1] (13)Permission denied: /home/bennybobw/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
    I chmodded -R 755 /home/bennybobw/www/franksmith/drupal
    Code:
    -rwxr-xr-x  1 bennybobw bennybobw 32225 2008-05-17 13:03 CHANGELOG.txt
    -rwxr-xr-x  1 bennybobw bennybobw   273 2008-05-17 13:03 cron.php
    lrwxrwxrwx  1 bennybobw bennybobw     8 2008-05-17 13:03 files -> ../files
    -rwxr-xr-x  1 bennybobw bennybobw  3978 2008-05-17 13:03 .htaccess
    drwxr-xr-x  3 bennybobw bennybobw  4096 2008-05-17 13:03 includes
    -rwxr-xr-x  1 bennybobw bennybobw   908 2008-05-17 13:03 index.php
    -rwxr-xr-x  1 bennybobw bennybobw  1475 2008-05-17 13:03 INSTALL.mysql.txt
    -rwxr-xr-x  1 bennybobw bennybobw  1101 2008-05-17 13:03 INSTALL.pgsql.txt
    -rwxr-xr-x  1 bennybobw bennybobw 22895 2008-05-17 13:03 install.php
    -rwxr-xr-x  1 bennybobw bennybobw  9485 2008-05-17 13:03 INSTALL.txt
    -rwxr-xr-x  1 bennybobw bennybobw 18406 2008-05-17 13:03 LICENSE.txt
    -rwxr-xr-x  1 bennybobw bennybobw  1856 2008-05-17 13:03 MAINTAINERS.txt
    drwxr-xr-x  4 bennybobw bennybobw  4096 2008-05-17 13:03 misc
    drwxr-xr-x 32 bennybobw bennybobw  4096 2008-05-17 13:03 modules
    drwxr-xr-x  4 bennybobw bennybobw  4096 2008-05-17 13:03 profiles
    -rwxr-xr-x  1 bennybobw bennybobw  1746 2008-05-17 13:03 robots.txt
    drwxr-xr-x  3 bennybobw bennybobw  4096 2008-05-17 13:03 scripts
    drwxr-xr-x  5 bennybobw bennybobw  4096 2008-05-17 13:03 sites
    drwxr-xr-x  6 bennybobw bennybobw  4096 2008-05-17 13:04 .svn
    drwxr-xr-x  8 bennybobw bennybobw  4096 2008-05-17 13:03 themes
    -rwxr-xr-x  1 bennybobw bennybobw 31341 2008-05-17 13:03 update.php
    -rwxr-xr-x  1 bennybobw bennybobw  3020 2008-05-17 13:03 UPGRADE.txt
    -rwxr-xr-x  1 bennybobw bennybobw   366 2008-05-17 13:03 xmlrpc.php
    Thanks for your help.
    Last edited by bennybobw; May 18th, 2008 at 10:13 PM. Reason: better title

  2. #2
    Join Date
    Nov 2005
    Beans
    40
    Distro
    Ubuntu 6.06

    Re: Can't access virtual hosts Re: Can't access virtual hosts (Apache2)

    I purged and removed Apache2 and php5 and re-installed, but I'm still getting the same error. I had virtual hosts working fine on Feisty and previous. Now I can't seem to get it to work.

    Any ideas??

  3. #3
    Join Date
    Nov 2005
    Location
    NEK Vermont
    Beans
    Hidden!
    Distro
    Ubuntu UNR

    Re: Apache looking in wrong dir for htaccess?

    I believe AllowOverride All causes apache to look for an .htaccess file in the directory...usually I put this in httpd.conf as well. Change to AllowOverride None

  4. #4
    Join Date
    Nov 2005
    Beans
    40
    Distro
    Ubuntu 6.06

    Re: Apache looking in wrong dir for htaccess?

    I know that AllowOverride All makes Apache look for an .htaccess file. I have an .htaccess file in the DocRoot, /home/bennybobw/www/franksmith/drupal. But why is it looking in /home/bennybobw/www instead of /home/bennybobw/www/franksmith/drupal? That's what the error message seems to be indicating.

  5. #5
    Join Date
    Nov 2005
    Location
    NEK Vermont
    Beans
    Hidden!
    Distro
    Ubuntu UNR

    Re: Apache looking in wrong dir for htaccess?

    ah. I apologise for not paying closer attention to your post. One possible problem is that the directory does not end with a forward slash:
    Code:
    <Directory /home/bennybobw/www/franksmith/drupal>
    should look like:
    Code:
    <Directory /home/bennybobw/www/franksmith/drupal/>
    Is there anything in httpd.conf regarding directives for .htaccess?

  6. #6
    Join Date
    Nov 2005
    Beans
    40
    Distro
    Ubuntu 6.06

    Re: Apache looking in wrong dir for htaccess?

    Yeah, I tried it with and withouth the slashes. No dice. This is the version without the slashes. I don't see anything in my apache2.conf about .htaccess (only defining it as the config file, but no other rules) and my httpd.conf is empty.
    It must be something incredibly simple that I'm missing. I could have sworn I had almost exactly the same thing set up on my last system, but I didn't copy the config files over.

  7. #7
    Join Date
    Nov 2005
    Location
    NEK Vermont
    Beans
    Hidden!
    Distro
    Ubuntu UNR
    Just had a thought. Is the .htpasswd file readable? That is, does it have correct permissions? And accessible to .htaccess by being in the /home directory.

    Document Root doesn't look right either, I thought it should look like:
    Code:
    DocumentRoot /home/bennybobw/www/franksmith/drupal/
    	<Directory />
    		Options FollowSymLinks
    		AllowOverride None
    	</Directory>
    Then your first directory would begin under that:
    <Directory /home/bennybobw/www/franksmith/drupal/>
    Options None
    AllowOverride All
    Order allow,deny
    allow from all
    </Directory>

    In httpd.comf:
    ServerName localhost
    ServerName <your dns or public ip here>
    <Directory /home/bennybobw/www/franksmith/drupal>
    AllowOverride All
    </Directory>

    <Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    </Files>

    Here is an example of mine, though I have disabled .htaccess, as I got tired of requiring authentication. The ht.access files are still in all my directories, I would just change AllowOverride (in each directory) and they work. Also they are renamed to .htsomethingelse and the filename specification in apache2.conf is changed to match.

    my virtual host:
    Code:
    NameVirtualHost *
    <VirtualHost *>
    	ServerAdmin admin@<my dns>
    	
    	DocumentRoot /home/spiderbatdad/public_docs/
    	<Directory />
    		Options FollowSymLinks
    		AllowOverride None
    	</Directory>
    	<Directory /home/spiderbatdad/public_docs/>
    		Options None
    		AllowOverride None
    		Order allow,deny
    		allow from all
    	</Directory>
            <Directory /home/spiderbatdad/public_docs/Sheetmusic/>
    		Options Indexes FollowSymLinks MultiViews
    		AllowOverride None
    		Order allow,deny
    		allow from all
    	</Directory>
             <Directory /home/spiderbatdad/public_docs/Music/>
    		Options Indexes FollowSymLinks MultiViews
    		AllowOverride None
    		Order allow,deny
    		allow from all
    	</Directory>
    My httpd.conf:
    Code:
    ServerName localhost
    ServerName <my dns>
    <Directory /home/spiderbatdad/public_docs/>
    AllowOverride None <This gets changed to ALL for htaccess>
    </Directory>
    
    <Files ~ "^\.ht">   (copied here from apache2.conf)
        Order allow,deny
        Deny from all
    </Files>
    Last edited by spiderbatdad; May 19th, 2008 at 07:35 PM.

  8. #8
    Join Date
    Nov 2005
    Beans
    40
    Distro
    Ubuntu 6.06

    Re: Apache looking in wrong dir for htaccess?

    Spiderbatdad thanks for your response. I don't have a .htpasswd file, since I'm not actually restricting access to certain users, just rewrite rules, etc.

    The .htaccess file rule [<Files ~ "^\.ht">] you have below is in my apache2.conf by default.

    I also tried adding the / to my site config, but maybe I'll give it another shot. Since that's an absolute path though, isn't that just blocking access to the actual root on the server? Anyway I'll try a couple of things when I get home from work.

  9. #9
    Join Date
    Nov 2005
    Beans
    40
    Distro
    Ubuntu 6.06

    Re: Apache looking in wrong dir for htaccess?

    Still getting the same error with this:
    Code:
    <VirtualHost *>
    	ServerAdmin webmaster@localhost
    	ServerName franksmith
    	DocumentRoot /home/bennybobw/www/franksmith/drupal/
    	<Directory />	
    		AllowOverride All
    		Options +ExecCGI FollowSymLinks MultiViews
    		Order allow,deny
    		Allow from all
    	</Directory>	
    	<Directory "/home/bennybobw/www">
    		Options FollowSymLinks
    		AllowOverride None
    	</Directory>
    	<Directory "home/bennybobw/www/franksmith/drupal/">
    		AllowOverride All
    		Options +ExecCGI FollowSymLinks MultiViews
    		Order allow,deny
    		Allow from all
    	</Directory>
    
    	ErrorLog /var/log/apache2/franksmith-error.log
    
    	# Possible values include: debug, info, notice, warn, error, crit,
    	# alert, emerg.
    	LogLevel warn
    
    	CustomLog /var/log/apache2/franksmith-access.log combined
    	ServerSignature On
    </VirtualHost>
    What am I doing wrong?
    Thanks for your help

  10. #10
    Join Date
    Nov 2005
    Beans
    40
    Distro
    Ubuntu 6.06

    Re: Apache looking in wrong dir for htaccess?

    If I change the line Allow Override All to Allow Override None under the / directory, I still get the same error.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •