Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

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

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

    Re: Apache looking in wrong dir for htaccess?

    I would set it up like so:

    Code:
    <VirtualHost *>
    	ServerAdmin webmaster@localhost
    	ServerName franksmith
    	DocumentRoot /home/bennybobw/www/
    	<Directory />	
    		AllowOverride All
    		Options None
    		Order allow,deny
    		Allow from all
    	</Directory>	
    	<Directory /home/bennybobw/www/franksmith/drupal/>
    		Options FollowSymLinks
    		AllowOverride All
    	</Directory>
    	<Directory "home/bennybobw/www/franksmith/drupal/">
    		AllowOverride All
    		Options +ExecCGI FollowSymLinks MultiViews
    		Order allow,deny
    		Allow from all
    	</Directory>
    Of course you have to have the .htaccess in each directory using AllowOverride All. In the example above, it is assumed the DocRoot has an index.html and an .htaccess file.

    Additionally, I found I had to include the directive in httpd.conf

    So httpd.conf gets set up like:
    Code:
    ServerName localhost
    ServerName franksmith (though this should actually be a dns or public ip)
    <Directory /home/bennybobw/www/>
    AllowOverride All
    </Directory>
    
    <Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    </Files>
    Again, it is assumed /home/bennybw/www has an index.html and an .htaccess file.
    I know you have ^\.ht directive in apache2.conf.

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

    Re: Apache looking in wrong dir for htaccess?

    Thanks for your reply spiderbatdad.

    I think this is getting way too complicated. The examples on
    ubuntu-tutorials.com
    or the apache2 virtualhost documentation or here on this very forum are not this complex.

    I've had this set up on Gutsy, Feisty and Edgy, so I know it works.

    Let's go back to the original problem. I want to set up a bunch of virtual hosts inside the dir /home/bennybobw/www/
    e.g.
    /home/bennbybw/www/mysite1
    /home/bennybobw/www/mysite2

    where /etc/hosts reads
    127.0.0.1 localhost mysite1 mysite2

    I do not want /home/bennybobw/www accessible or as a DocumentRoot and I don't think I need to put anything about it in the site file. The DocumentRoot for each virtual host should be in /home/bennybobw/www/sitename, which is where Apache2 should be looking for an .htaccess file.

    Here's the only things I'm thinking I need to include in my site file:
    Code:
    <VirtualHost *>
            ServerName franksmith
            ServerAlias *.franksmith
            DocumentRoot /home/bennybobw/www/franksmith/drupal
            <Directory /home/bennybobw/www/franksmith/drupal>
                AllowOverride All
    	    Options +ExecCGI FollowSymLinks MultiViews
    	    Order allow,deny
    	    Allow from all
            </Directory>  
    </VirtualHost>
    It's looks like I'm not the only one having this problem, and I've asked him to post his errors over here. Maybe all of us together can solve this.

    I've never put anything in httpd.conf before, but maybe Hardy has a new configuration that I need to? There shouldn't be any need to post duplicate directives though...

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

    Re: Apache looking in wrong dir for htaccess?

    what you have posted above should work fine. However, put this in httpd.conf, also, and it will work:
    Code:
    ServerName localhost
    ServerName <your_ip>
    <Directory /home/bennybobw/www/franksmith/drupal/>
    AllowOverride All
    </Directory>
    Restart the server of course.

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

    Re: Apache looking in wrong dir for htaccess?

    Ok...
    So I copied my www file from ext3 to FAT16 and then back to ext3. The permissions on all the files inside www were preserved but www itself was set so only the owner could read it....

    The problem wasn't in my conf but the permissions on www ....Ahhhhh....

    Thanks for your help SpiderBatDad.

    p.s. in the end, I didn't need that line in httpd.conf, just the virtualhost declaration I posted last.
    Last edited by bennybobw; May 22nd, 2008 at 06:26 AM.

  5. #15
    Join Date
    Sep 2007
    Beans
    23

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

    Hi,
    You people had asked me to post here about my problem in the post I had done. So this is how my sites-available/drupal6 file looks.

    <VirtualHost *>
    ServerAdmin madhusudancs@gmail.com
    ServerName drupal6
    ServerAlias www.locald6.com

    DocumentRoot /home/madhu/mywebdevelopment/drupal6.0/
    <Directory />
    Options FollowSymLinks
    AllowOverride All
    </Directory>
    <Directory /home/madhu/mywebdevelopment/drupal6.0/>
    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/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined
    ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

    </VirtualHost>

    and as you said have enabled the site and have added 127.0.0.3 drupal6
    to the host. But when I give drupal6 in browser it gives the following error, and have added same configurations as you have indicated to httpd.conf.

    403 Forbidden

    You don’t have permission to access / on this server.

    My apache error.log has the following entries

    Mon Jun 02 09:18:50 2008] [crit] [client 127.0.0.3] (13)Permission denied: /home/madhu/mywebdevelopment/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

    Note that even though my DocRoot points to one directory below i. /home/…/mywebdevelopment/drupal6.0 it is looking for .htaccess in mywebdevelopment. So just to test I put my .htaccess copy there also. Still it shows the same error. Permission on all the files and directories is set to 777.

    Please help me. Thanks a lot

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

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

    Make sure the permissions on /home/madhu/mywebdevelopment are 755
    That's what was causing the problem with mine.

  7. #17
    Join Date
    Sep 2007
    Beans
    23

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

    Hey thanks a lot, chmod 755 on mywebdevelopment is working. But I had kept it as 777. Why not 777 and why only 755? Any idea?

  8. #18
    Join Date
    Jul 2006
    Location
    Russia St. Petersburg
    Beans
    Hidden!

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

    For any google strangers here, /home/%username% should be executable by apache, so chmod a+x /home/%username%

  9. #19
    Join Date
    Jun 2007
    Location
    Porirua, New Zealand
    Beans
    Hidden!
    Distro
    Ubuntu

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

    And with that useful tip, this thread can go back to sleep.
    Forum DOs and DON'Ts
    Please use CODE tags
    Including your email address in a post is not recommended
    My Blog

Page 2 of 2 FirstFirst 12

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
  •