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

Hi all experts.
I installed apache 2.0.52 and php4.3.9 on my fedora linux box.
I configured apache first and was able to open the defalt apache welcome page by accessing the server using IP address.
And then I created a php info page in the apache default directory to see if php works. php worked no problem.
The problem occurred when I added a domain to virtual hosting section.
Now I have only one domain to host, but I am going to host more so I created a web directory in user's home directory and
in http.conf file I added the virtual host settings like below

NameVirtualHost     ip of my server

<VirtaulHost ipaddress>
    ServerAdmin webmaster@domain.com
    DocumentRoot /home/user1/www
    ServerName domain.com
    ServerAlias www.domain.com
    DirectoryIndex index.html index.php
</VirtualHost>

I have tried to access a file in the user1's web directory by www.domain.com/file1.php. But still got the permission error.
I have set all directory and file permissions in the user1's directory 777 in order to test it. But no hope.
Please help me out with this problem.. Thanks advance.
soweyoungAsked:
Who is Participating?
 
ahoffmannCommented:
>  (13)Permission denied: access to /index.php denied

is a filesystem permission problem. Check owner and group of directory and file, and the permissions of them. The user of your httpd-process need read permissions to the file and execute permission to the directory
0
 
ramazanyichCommented:
Did you check error log of your Apache server?
some times you can find useful info there.
Could you send what is in error.log ?
0
 
soweyoungAuthor Commented:
I found nothing special in the apache error log file.
I am not sure if the web server even tries to open a correct directory.

[Fri Oct 15 18:22:29 2004] [notice] Apache/2.0.52 (Unix) configured -- resuming normal operations
[Fri Oct 15 18:36:48 2004] [notice] caught SIGTERM, shutting down
[Fri Oct 15 18:36:57 2004] [notice] Apache/2.0.52 (Unix) PHP/4.3.9 configured -- resuming normal operations
[Sat Oct 16 10:14:43 2004] [notice] caught SIGTERM, shutting down
[Sat Oct 16 10:16:08 2004] [notice] Apache/2.0.52 (Unix) PHP/4.3.9 configured -- resuming normal operations
[Sat Oct 16 10:16:15 2004] [error] [client 68.145.84.236] (13)Permission denied: access to / denied
[Sat Oct 16 10:17:15 2004] [notice] caught SIGTERM, shutting down
[Sat Oct 16 10:17:19 2004] [notice] Apache/2.0.52 (Unix) PHP/4.3.9 configured -- resuming normal operations
[Sat Oct 16 10:18:32 2004] [error] [client 68.145.84.236] (13)Permission denied: access to / denied
[Sat Oct 16 10:18:33 2004] [error] [client 68.145.84.236] (13)Permission denied: access to / denied
[Sat Oct 16 10:18:41 2004] [error] [client 68.145.84.236] (13)Permission denied: access to /index.php denied
[Sat Oct 16 10:23:07 2004] [error] [client 68.145.84.236] (13)Permission denied: access to /main.html denied
[Sat Oct 16 10:23:13 2004] [error] [client 68.145.84.236] (13)Permission denied: access to /main.htm denied
[Sat Oct 16 10:29:04 2004] [error] [client 68.145.84.236] (13)Permission denied: access to /main.htm denied
[Sat Oct 16 10:29:05 2004] [error] [client 68.145.84.236] (13)Permission denied: access to /main.htm denied
[Sat Oct 16 10:29:10 2004] [error] [client 68.145.84.236] (13)Permission denied: access to /main.htm denied
[Sat Oct 16 10:32:24 2004] [error] [client 68.145.84.236] (13)Permission denied: access to /index.html denied
[Sat Oct 16 10:33:14 2004] [error] [client 68.145.84.236] (13)Permission denied: access to /index.html denied
[Sat Oct 16 10:33:19 2004] [error] [client 68.145.84.236] (13)Permission denied: access to /index.php denied
[Sat Oct 16 10:37:01 2004] [error] [client 68.145.84.236] (13)Permission denied: access to /index.php denied
[Sat Oct 16 10:37:09 2004] [error] [client 68.145.84.236] (13)Permission denied: access to /index.php denied
[Sat Oct 16 10:44:44 2004] [notice] caught SIGTERM, shutting down
[Sat Oct 16 10:44:47 2004] [notice] Apache/2.0.52 (Unix) PHP/4.3.9 configured -- resuming normal operations
[Sat Oct 16 10:44:57 2004] [error] [client 68.145.84.236] (13)Permission denied: access to / denied
[Sat Oct 16 10:56:58 2004] [notice] caught SIGTERM, shutting down
[Sat Oct 16 10:57:26 2004] [notice] Apache/2.0.52 (Unix) PHP/4.3.9 configured -- resuming normal operations
[Sat Oct 16 10:57:30 2004] [error] [client 68.145.84.236] (13)Permission denied: access to / denied
[Sat Oct 16 11:04:49 2004] [error] [client 68.145.84.236] (13)Permission denied: access to / denied
[Sat Oct 16 11:04:51 2004] [error] [client 68.145.84.236] (13)Permission denied: access to / denied
[Sat Oct 16 11:08:22 2004] [notice] caught SIGTERM, shutting down
[Sat Oct 16 11:08:24 2004] [notice] Apache/2.0.52 (Unix) PHP/4.3.9 configured -- resuming normal operations
[Sat Oct 16 11:27:35 2004] [notice] caught SIGTERM, shutting down
[Sat Oct 16 11:27:39 2004] [notice] Apache/2.0.52 (Unix) PHP/4.3.9 configured -- resuming normal operations
[Sat Oct 16 11:27:44 2004] [error] [client 68.145.84.236] (13)Permission denied: access to /index.php denied
[Sat Oct 16 14:30:01 2004] [error] [client 68.145.84.236] (13)Permission denied: access to / denied

 

0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
ramazanyichCommented:
Try to add follozing in under <VirtualHost> element:
<Location />
allow from all
</Location
0
 
periwinkleCommented:
Or perhaps:

<VirtualHost ipaddress>
    ServerAdmin webmaster@domain.com
    DocumentRoot /home/user1/www
    ServerName domain.com
    ServerAlias www.domain.com
    DirectoryIndex index.html index.php
    <Directory /home/user1/www>
      order allow,deny
      allow from all
     </Directory>
</VirtualHost>
0
 
periwinkleCommented:
Is it only the PHP files that can't be used?
0
 
soweyoungAuthor Commented:
I added Directoy tag as you said, but still got the same error.
I now have a couple of simpe php and html files in the apache default web directory and user directory to test.
However I can't access any of the files using ip or domain, not even with files names after.
This is the error message I get in the browser.

Forbidden
You don't have permission to access /test.html on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

--------------------------------------------------------------------------------

Apache/2.0.52 (Unix) PHP/4.3.9 Server at 216.240.152.97 Port 80

Any idea or clue about this?
0
 
soweyoungAuthor Commented:
If I comment out the virtual hosting portion from the httpd.conf and put all kinds of html and php files, every file works well.
But I have to host multiple sites later so I need to figure out how to exactly correct this problem.
0
 
ramazanyichCommented:
As it is described in doc:
"If you are adding virtual hosts to an existing web server, you must also create a <VirtualHost> block for the existing host. The ServerName and DocumentRoot included in this virtual host should be the same as the global ServerName and DocumentRoot. List this virtual host first in the configuration file so that it will act as the default host."
example:

NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /www/domain
</VirtualHost>
<VirtualHost *:80>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>



check http://httpd.apache.org/docs-2.0/vhosts/name-based.html for details
0
 
davemiles871Commented:
Chances are this is not in fact the correct solution- I'm guessing but if its working for you, then you probably changed something else already. I have had the same problem, and just changing permissions does not in fact work. The actual cause of this is 'by design' if you have a default installation of FC3. SE-Linux which is installed as part of the default installation, stops access to aliased directories and the like, including virtual hosts. Bizare though it is, it also stops Apache from accessing some of its own directories (note the ErrorDocument error)

Whilst I don't have a complete workround, the simplest solution to get the system up and working is to go to System Settings->Security level and disable SE-Linux. This will prove one way or another what's what, and we can move on from there. If I get better fix, I'll post again.
0
 
svinetCommented:
excellent answer
here is how to disable SELinux. vi /etc/sysconfig/selinux then disable it.
0
 
kbenschCommented:
The problem you are expericneing is not a problem as such but ratrher a feature of FC3 called Security enhanced linux.

Try this

ls -Z /dir/where/www/root/will/be

chcon -R -h -t httpd_sys_content_t /dir/where/www/root/will/be

ls -Z /dir/where/www/root/will/be

It will prob be a good idea to turn selinux on again in the /etc/sysconfig/selinux conf file as it makes it so much more secure.

Hope this helps
0
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.

All Courses

From novice to tech pro — start learning today.