LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   apache access forbidden (https://www.linuxquestions.org/questions/linux-newbie-8/apache-access-forbidden-746273/)

qwertyjjj 08-09-2009 03:33 PM

apache access forbidden
 
I have started apache and sarg on my server but I don't seem to be able to view anything when I go to http://myip.xxx.xxx.xxx/sarg

just says 403 forbidden
Forbidden

You don't have permission to access /sarg on this server.
Apache/2.2.3 (FH) Server at 88.xxx.xxx.xxx Port 80

any clues as to why?

unSpawn 08-09-2009 07:38 PM

When troubleshooting 403's best check what user Apache runs as and verify access perms on $DOCROOT/sarg dir are sufficient (and check the httpd log for clues if you have to).

qwertyjjj 08-10-2009 02:49 AM

Quote:

Originally Posted by unSpawn (Post 3637127)
When troubleshooting 403's best check what user Apache runs as and verify access perms on $DOCROOT/sarg dir are sufficient (and check the httpd log for clues if you have to).

Right, how do I fine out what user apache runs as?
I assume it's as apache or web?
chmod changes perms - I couldn't find any info on google for how to list permissions on a directory. When I do locate sarg it only give me the install folder even though it's definitely there somewhere.
where is the httpd log stored? Do I need to turn logging on or is it automatic?

PMP 08-10-2009 02:53 AM

Try keeping an index.html file in the directory sarg. then access this.

Other way is to turn the directory listing on in the apache conf file

qwertyjjj 08-10-2009 03:35 AM

Quote:

Originally Posted by PMP (Post 3637408)
Try keeping an index.html file in the directory sarg. then access this.

Other way is to turn the directory listing on in the apache conf file

But what should the index.html file point to?

PMP 08-10-2009 04:47 AM

My aim for keeping the index.html inside it is to see wether your configuration is serving the request or not. whenever it finds a directory in the URL it looks for index.html or default.html file.
In your case I believe no such file is present in this directory. hence it tires to list the contents of this directory, But unfortunately in your httpd configuration file you have not allowed directory listing, thus you the forbidden error.

qwertyjjj 08-10-2009 04:53 AM

Quote:

Originally Posted by PMP (Post 3637541)
My aim for keeping the index.html inside it is to see wether your configuration is serving the request or not. whenever it finds a directory in the URL it looks for index.html or default.html file.
In your case I believe no such file is present in this directory. hence it tires to list the contents of this directory, But unfortunately in your httpd configuration file you have not allowed directory listing, thus you the forbidden error.

Well...if I type in http://IP.IP.IP.IP/
it gives me the default apache page of index.html saying a site has not been set up yet.
Does the sarg folder contain html files?
I jyst checked the directory in the arg folder - there is an index.html there already
chmod 755 /var/www/sarg doesn't help

unSpawn 08-10-2009 05:36 AM

Quote:

Originally Posted by qwertyjjj (Post 3637405)
Right, how do I fine out what user apache runs as? I assume it's as apache or web?

Don't assume: make certain. Look at its main configuration file and the startup script.


Quote:

Originally Posted by qwertyjjj (Post 3637405)
chmod changes perms - I couldn't find any info on google for how to list permissions on a directory.

Running 'ls -ld /path/to/directory' (or 'stat -c "%a %U %G" /path/to/directory') will show.


Quote:

Originally Posted by qwertyjjj (Post 3637405)
When I do locate sarg it only give me the install folder even though it's definitely there somewhere.

Sarg may use its own configuration file to be included by the running webserver from say /etc/httpd/conf.d/. The configuration file may include Allow/Deny rules.


Quote:

Originally Posted by qwertyjjj (Post 3637405)
where is the httpd log stored? Do I need to turn logging on or is it automatic?

Both questions can be answered by reading its main configuration file.

qwertyjjj 08-10-2009 05:40 AM

I have 2 apache.conf files:
/usr/share/matrixsa-webware/WebKit/Adapters/mod_webkit/apache.conf
/usr/share/matrixsa-webware/WebKit/Adapters/mod_webkit2/apache.conf

which one does the startup?

I cannot find any log files in: /var/log/httpd/
though it seems there is an access_log folder but using cd I can't get into it, says invalid name

jeromeNP7 08-10-2009 05:56 AM

Apache configuration files should be in /etc/httpd on RedHat based systems (like CentOS, which mimicks RHEL). Your web directory should be /var/www/html, unless you have choosen other locations during installation. My interpretation of your problem is that sarg is not within /var/www/html or it is simply an empty directory or has no index.* file(s) or directory permissions are not correct.

Linux

qwertyjjj 08-10-2009 06:03 AM

Quote:

Originally Posted by jeromeNP7 (Post 3637597)
Apache configuration files should be in /etc/httpd on RedHat based systems (like CentOS, which mimicks RHEL). Your web directory should be /var/www/html, unless you have choosen other locations during installation. My interpretation of your problem is that sarg is not within /var/www/html or it is simply an empty directory or has no index.* file(s) or directory permissions are not correct.

sarg is in /var/www/sarg but the index file is there.
I chmodded the folder to 755.

There are no files at all in /var/www/html
The current default page when I request http://myip.myip.myip.myip loads up from /var/www/error/noindex.html

Since I can see the sarg folder and get to it on the web using http://myip.xx.xx.xx/sarg but get a 403 error, it must be permissions. But 755 should be enough shouldn't it?

zhjim 08-10-2009 06:16 AM

Quote:

Originally Posted by qwertyjjj
Since I can see the sarg folder and get to it on the web but get a 403 error, it must be permissions. But 755 should be enough shouldn't it?

775 sure is enough but make sure that all the folders down from the root are readable by the webuser.

Quote:

Originally Posted by qwertyjjj
sarg is in /var/www/sarg but the index file is there.
I chmodded the folder to 755.

The log files should give you a hint what going on. Do a tail -f /var/log/http/acces_log and then connect to the webserver

Else I would just check on the configuration file or do a apachectl -S to get a view of all the hosts your apache is configured for.

Nother thing to try out is to create a file like "my.html" inside the /var/www/sarg folder and call it up. If this succedes you know that the permissions are right.

linuxlover.chaitanya 08-10-2009 06:19 AM

Try to move the sarg folder under /var/www/html and see if it is accessible.

qwertyjjj 08-10-2009 06:20 AM

Quote:

Originally Posted by zhjim (Post 3637626)
775 sure is enough but make sure that all the folders down from the root are readable by the webuser.



The log files should give you a hint what going on. Do a tail -f /var/log/http/acces_log and then connect to the webserver

Else I would just check on the configuration file or do a apachectl -S to get a view of all the hosts your apache is configured for.

Nother thing to try out is to create a file like "my.html" inside the /var/www/sarg folder and call it up. If this succedes you know that the permissions are right.

I can't get to access_log ?!

Code:

[root@localhost log]# cd /var/log/httpd
[root@localhost httpd]# dir
access_log  error_log  ssl_access_log  ssl_error_log  ssl_request_log
[root@localhost httpd]# cd access_log
-bash: cd: access_log: Not a directory
[root@localhost httpd]# cd /var/log/httpd/access_log
-bash: cd: /var/log/httpd/access_log: Not a directory
[root@localhost httpd]#

Quote:

Originally Posted by linuxlover.chaitanya (Post 3637631)
Try to move the sarg folder under /var/www/html and see if it is accessible.

Did that but still no luck

qwertyjjj 08-10-2009 06:37 AM

tail -f /var/log/httpd/access_log gives this when I access the page
86.xxx.xxx.xx - - [10/Aug/2009:12:36:38 +0100] "GET /sarg HTTP/1.1" 403 281 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11"

[root@localhost ~]# apachectl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:443 localhost.localdomain (/etc/httpd/conf.d/ssl.conf:81)
Syntax OK
[root@localhost ~]#


All times are GMT -5. The time now is 05:22 PM.