?
Solved

Apache 2: Forbiden Error

Posted on 2005-03-14
17
Medium Priority
?
274 Views
Last Modified: 2010-03-17
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
0
Comment
Question by:1-WireWorld_net
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 5
17 Comments
 
LVL 19

Expert Comment

by:Barthax
ID: 13533010
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
 
LVL 1

Expert Comment

by:pmrussell892
ID: 13533306
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
 

Author Comment

by:1-WireWorld_net
ID: 13538173
Where would I put the:

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


"hosts.allow" ??


Thanks,
Kanan
0
WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

 

Author Comment

by:1-WireWorld_net
ID: 13538183
Barthax,

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

Thanks anyway,

Kanan
0
 
LVL 1

Expert Comment

by:pmrussell892
ID: 13538469
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
 

Author Comment

by:1-WireWorld_net
ID: 13538600
Apache-AdvancedExtranetServer/2.0.50 (Mandrakelinux/5mdk) mod_ssl/2.0.50 OpenSSL/0.9.7d PHP/4.3.8
0
 

Author Comment

by:1-WireWorld_net
ID: 13538654
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
 
LVL 1

Expert Comment

by:pmrussell892
ID: 13541810
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
 
LVL 19

Assisted Solution

by:Barthax
Barthax earned 1000 total points
ID: 13544628
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
 
LVL 19

Expert Comment

by:Barthax
ID: 13544635
Do you have any .htaccess files in the / of the site?
0
 

Author Comment

by:1-WireWorld_net
ID: 13549543
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
 

Author Comment

by:1-WireWorld_net
ID: 13549562
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
 

Author Comment

by:1-WireWorld_net
ID: 13549568
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
 
LVL 1

Expert Comment

by:pmrussell892
ID: 13549706
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
 
LVL 1

Accepted Solution

by:
pmrussell892 earned 1000 total points
ID: 13549739

"
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
 
LVL 19

Expert Comment

by:Barthax
ID: 13554132
>  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
 
LVL 19

Expert Comment

by:Barthax
ID: 13554165
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

Featured Post

Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question