Apache 2: Forbiden Error

Hi all, I have configured my apache server a few different ways.  I started with using vhosts, then I used a rewrite rule that parsed to a directory and now I'm using dynamlic hosts.

However, no matter what I use I get the same error," Forbidden, You don't have permission to access / on this server."

You can check it out, http://www.knoxcrew.com/

I'm just looking to configure 10 or 12 host names, nothing to huge.

I'm sorry I can't be more specific, I don't know apache to well yet.

If there are any log files or config files that it would help if I posted, just let me know.


Thanks all,

Kanan
1-WireWorld_netAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BarthaxCommented:
I think by default the DirectoryIndex states only index.html.  Do you have an index.html on the site?  If not, Apache is probably interpretting the request as a directory listing and by default this is normally disabled.  If you have a index.htm (or other file which you are using as the default file in a directory) change the DirectoryIndex statement to include the file name.
0
pmrussell892Commented:
Do you have <Directory "/path/to/your/directory/">
                     Order Allow,Deny
                     Allow from all
                    </Directory>



To explicitly enable access to these directory's

By default apache disables access to all files and you have to explicitly enable access to the directorys you want.

When I get these errors this is always the first thing i check
0
1-WireWorld_netAuthor Commented:
Where would I put the:

<Directory "/path/to/your/directory/">
    Order Allow,Deny
    Allow from all
</Directory>


"hosts.allow" ??


Thanks,
Kanan
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

1-WireWorld_netAuthor Commented:
Barthax,

I can point it at files that should be there, and I still get the same error.

Thanks anyway,

Kanan
0
pmrussell892Commented:
Where you would put the

<Directory "/path/to/your/directory/">
    Order Allow,Deny
    Allow from all
</Directory>

Depends on what version of apache you are using. If it is apache 1.x.x then it will go into your
httpd.conf
file

If you are using apache 2.0.xx Then it would either go into your default-server.conf or your

path/to/apache/conf/conf.d/yourhostname.conf

What version of apache are you using? And I will be able to help you out further.
0
1-WireWorld_netAuthor Commented:
Apache-AdvancedExtranetServer/2.0.50 (Mandrakelinux/5mdk) mod_ssl/2.0.50 OpenSSL/0.9.7d PHP/4.3.8
0
1-WireWorld_netAuthor Commented:
my Directory structure is set up like this

/
    www
          www.host_1.com
                html
          www.host_2.com
                html
          www.host_N.com
                html


Can I just open up the entire /www/ directory?  All I really want on the interent is the /www/www.host_1.com/html peice, but I don't want to have to put the allow statement in 15 different places and have to remember to add it everytime I want to add a host.

Is there anyway to do it dynamicly?
0
pmrussell892Commented:
I have never used that structure before

Can you post your

error.log and access.log

These should be somewhere under

/var/logs/apache2
 
or somewhere similiar
0
BarthaxCommented:
Personally, I use:

DocumentRoot "path/to/www"
<Directory "path/to/www">
Order allow, deny
Allow ...
</Directory>

NameVirtualHost mydefaultsite

<VirtualHost mydefaultsite>
DocumentRoot "path/to/www/firstsite"
...
</VirtualHost>

<VirtualHost mysecondsite>
DocumentRoot "path/to/www/secondsite"
...
</VirtualHost>

<VirrualHost localhost>
DocumentRoot "path/to/www"
...
</VirtualHost>

etc...  Works fine for me.
0
BarthaxCommented:
Do you have any .htaccess files in the / of the site?
0
1-WireWorld_netAuthor Commented:
No I don't think I do have and .htaccess files.  I haven't added any.  There may be if there were defaults.

The reason for my unsual structure is that /www is a separate phisical drive, I wanted to keep it away from the OS so if I need to change computers it's an easy swap.

Stupid maybe, I don't know.  I'm just doing my best with it all.


------

Just to clarify, you don't use an 'html' directory under your sites?  So that means that all of the content under the '/path/tp/www/mysite.org/' is live?

What about log files and unique PERL and CGI files?

It sounds a lot simpler, but I thought there were reasons not to do it that way?

0
1-WireWorld_netAuthor Commented:
Barthax:

Do you put the:
 
DocumentRoot "path/to/www"
<Directory "path/to/www">
Order allow, deny
Allow ...
</Directory>

lines in you 'vhosts.conf' ?  I guess it is all included in the httpd.conf using an include anyway.

Are you using Apache 2?
0
1-WireWorld_netAuthor Commented:
PM Russel,

I'll post my error log as soon as I can.  I'm at work and don't have access to thoes files right now.
0
pmrussell892Commented:
Can I just open up the entire /www/ directory?  All I really want on the interent is the /www/www.host_1.com/html peice, but I don't want to have to put the allow statement in 15 different places and have to remember to add it everytime I want to add a host.

Is there anyway to do it dynamicly?

That is the way apache is setup. it is like that for security reasons. and also to allow each site to be accessible from its domain

www.host1.com would serve up the host1 directory.
www.host2.com would serve up host 2 directory.
and so on.....

you can do it the way you are asking about but then you have to either use rewrite rules. or enter the url www.sitenme.com/host1
www.sitename.com/host2

The way barthax has it is really not that hard at all.

When you want to add a new site just copy the <vurtual host "/path/to/documents/> down under it and simply change the document root and host name. Not hard at all.

writing a bunch of rewrite rules is much harder than the way of doing it as barthax's example.

0
pmrussell892Commented:

"
Can I just open up the entire /www/ directory?  All I really want on the interent is the /www/www.host_1.com/html peice, but I don't want to have to put the allow statement in 15 different places and have to remember to add it everytime I want to add a host."

Yes that is what barthax did with

"
DocumentRoot "path/to/www"
<Directory "path/to/www">
Order allow, deny
Allow ...
</Directory>

"

Then each virtual host has a root under www which is already open

<VirtualHost mydefaultsite>
DocumentRoot "path/to/www/firstsite"
...
</VirtualHost>

<VirtualHost mysecondsite>
DocumentRoot "path/to/www/secondsite"
...
</VirtualHost>

<VirrualHost localhost>
DocumentRoot "path/to/www"
...
</VirtualHost>

This is very easy, all you have to do is copy and paste and then change the virtual host name and document root.




0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BarthaxCommented:
>  Just to clarify, you don't use an 'html' directory under your sites?  So that means that all of the content under the '/path/tp/www/mysite.org/' is live?

> What about log files and unique PERL and CGI files?

Everything beneath that directory is live in the way that *I* use it.  You can of course add a /html to the end of your own.  I'm a little confused as to what you may have read that gives you the impression that you shouldn't do it the way I have.

The *only* things I have beneath my site directories are the primary portions of the html/php, images and downloads.  In terms of CGI stuff, you can use Alias commands to redirect to anywhere else (personally, php does everything I need, so I don't bother with Perl/CGI).
0
BarthaxCommented:
While I have used Apache 2 in the past, I currently stick with Apache 1.3 due to unfortunate dependancies.  I have used Apache 2 in the way I state also. :)  It just took a little while to figure out that some stuff I use still depends on 1.3. :(

Apache 2's conf files are split to make it easier for the user to use.  Place the VirtualHost tags in the Vhost.conf and the Directory stuff in your main http.conf.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.