LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache Help (https://www.linuxquestions.org/questions/linux-server-73/apache-help-680489/)

mitchell2345 11-01-2008 12:08 PM

Apache Help
 
Hi,

I have appache running with no problems on my CentOS box. Serving my MythWeb and MySQLadmin page.

I am trying to get MRTG pages to display. MRTG is configure right and pulling data from my router but i cant view the html pages through apache. when trying 192.168.0.202/mrtg I get a 403 forbidden error message.

Details:
MRTG HTML files are in: /var/www/html/mrtg
Code:

[root@mythtv html]# pwd
/var/www/html
[root@mythtv html]# ls -l
total 12
drwxr-xr-x  2 apache apache 4096 Nov  1 11:50 mrtg
drwxr-xr-x 10 root  root  4096 Aug  9 13:54 mysql
drwxrwxr-x 10 apache apache 4096 Aug  9 11:24 mythweb

[root@mythtv mrtg]# ls -lh /var/www/html/mrtg/
total 1.2M
-rwxr-xr-- 1 apache apache 1.4K Nov  1 11:50 192.168.0.1_12-day.png
-rwxr-xr-- 1 apache apache 6.3K Nov  1 11:50 192.168.0.1_12.html
-rw-rw-r-- 1 apache apache  48K Nov  1 11:50 192.168.0.1_12.log

httpd.conf file:
Code:

<Directory "/var/www/html/mrtg">
    Options Indexes FollowSymLinks
    AuthType Basic
    AuthName "MRTG"
    AuthUserFile /etc/httpd/conf/httpd-passwords
    require user mitchell
    Order allow,deny
    Allow from 192.168.0.
    Satisfy any
</Directory>

(this should work as i use the same code for Mythweb

Logs:
error_log:
Code:

[Sat Nov 01 12:03:25 2008] [error] [client 192.168.0.149] client denied by server configuration: /var/www/mrtg
access_log:
Code:

192.168.0.149 - - [01/Nov/2008:12:03:25 -0500] "GET /mrtg/ HTTP/1.1" 403 285 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 (.NET CLR 3.5.30729)"
Why am I getting this 403 error?

Thanks,
Mitchell

anomie 11-01-2008 12:21 PM

Do you need to set up an Alias for that directory?

Quote:

<Directory "/var/www/html/mrtg">
...
client denied by server configuration: /var/www/mrtg
/var/www/html/mrtg != /var/www/mrtg

Maybe you are more restrictive at the / directory, so you're seeing this error. (Again, you could make a /mrtg Alias.)

---------

Edit: I take it back. I just tested out a config similar to your own, and an Alias was not required. (i.e. My DocumentRoot is /var/www/html.)

I'm not sure what your issue is.

mitchell2345 11-01-2008 12:26 PM

Quote:

Originally Posted by anomie (Post 3328367)
Do you need to set up an Alias for that directory?



/var/www/html/mrtg != /var/www/mrtg

Maybe you are more restrictive at the / directory, so you're seeing this error. (Again, you could make a /mrtg Alias.)

I noticed that from the logs but i dont know where /var/www/mrtg is coming from. I dont have a /var/www/mrtg:

Code:

[root@mythtv cfg]# ls /var/www/
cgi-bin  error  html  icons  manual  usage

Ideas on how to fix that?

Mitchell

anomie 11-01-2008 12:33 PM

In light of my edit (in my first post), I would double check your DocumentRoot. If you changed it to /var/www then that might explain the error.

mitchell2345 11-01-2008 12:50 PM

nope, document root is correct:

DocumentRoot "/var/www/html"

Im really confused becuase 192.168.0.202/mythweb works but 192.168.0.202/mrtg gives 403!

AHHH.

sleddog 11-01-2008 01:46 PM

Remove all access restrictions (auth and 'allow from') from the mrtg directory and try browsing again. The apache logs might then give a better indication of what's happening.

mitchell2345 11-01-2008 01:53 PM

Quote:

Originally Posted by sleddog (Post 3328437)
Remove all access restrictions (auth and 'allow from') from the mrtg directory and try browsing again. The apache logs might then give a better indication of what's happening.

Ok, so my new file has:

#<Directory "/var/www/html/mrtg">
# Options Indexes FollowSymLinks
# AuthType Basic
# AuthName "MRTG"
# AuthUserFile /etc/httpd/conf/httpd-passwords
# require user mitchell
# Order allow,deny
# Allow from 192.168.0.
# Satisfy any
#</Directory>

I posted my logs from apache ealier but here they are again. I have cat /dev/null'ed them before hitting the page so this is what is generated when i hit that exact page.

Code:

[root@mythtv httpd]# cat access_log
192.168.0.149 - - [01/Nov/2008:13:51:46 -0500] "GET /mrtg/index.html HTTP/1.1" 403 295 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 (.NET CLR 3.5.30729)"
[root@mythtv httpd]# cat error_log
[Sat Nov 01 13:51:46 2008] [error] [client 192.168.0.149] client denied by server configuration: /var/www/mrtg

Again, where the heck is that /var/www/mrtg coming from?!

Mitchell

robertjinx 11-01-2008 01:59 PM

Man look at additional include configuration files for apache, if especial you install mtrg and apache from centos repo, I think they are in /etc/httpd/conf.d/mtrg.conf or something like that.

You should have in /etc/httpd/conf/httpd.conf some entry:

Include /etc/httpd/conf.d/*

Just check...

Check coz you are confusing the server having maybe 2 entries.

sleddog 11-01-2008 02:04 PM

If you make another directory under 'html', e.g., 'test', and put an html file in it, can you browse it OK?

If no, then there's an issue with your httpd.conf. Check httpd.conf to make sure there aren't two DocumentRoot lines. Review configuration for the / directory.

If you can browse it OK, then the problem is specific to the 'mrtg' directory. Is there an .htaccess file in the mrtg directory? Check its contents. grep for any occurrence of 'mrtg' in httpd.conf, or in any file included in httpd.conf.

mitchell2345 11-01-2008 02:45 PM

Quote:

Originally Posted by robertjinx (Post 3328444)
Man look at additional include configuration files for apache, if especial you install mtrg and apache from centos repo, I think they are in /etc/httpd/conf.d/mtrg.conf or something like that.

You should have in /etc/httpd/conf/httpd.conf some entry:

Include /etc/httpd/conf.d/*

Just check...

Check coz you are confusing the server having maybe 2 entries.

THANK YOU THANK YOU THANK YOU!!!!

That was it.

Originally mrtg.conf was:
Code:

[root@mythtv www]# cat /etc/httpd/conf.d/mrtg.conf
#
# This configuration file maps the mrtg output (generated daily)
# into the URL space.  By default these results are only accessible
# from the local host.
#
Alias /mrtg /var/www/mrtg

<Location /mrtg>
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
    Allow from ::1
    # Allow from .example.com
</Location>

Changed it to:
Code:

[root@mythtv ~]# cat /etc/httpd/conf.d/mrtg.conf
#
# This configuration file maps the mrtg output (generated daily)
# into the URL space.  By default these results are only accessible
# from the local host.
#
Alias /mrtg /var/www/html/mrtg

<Location /mrtg>
    Order deny,allow
    Deny from all
    Allow from 192.168.0.
</Location>

And to give authentication to the outside I changed my httpd.conf file back to:
Code:

<Directory "/var/www/html/mrtg">
    Options Indexes FollowSymLinks
    AuthType Basic
    AuthName "MRTG"
    AuthUserFile /etc/httpd/conf/httpd-passwords
    require user mitchell
    Order allow,deny
    Allow from 192.168.0.
    Satisfy any
</Directory>

Restarted apache and BINGO.

This makes no sense..Why would MRTG rpms make the config file for web pages point to /var/www when the default Apache root directory is /var/www/html!

Well its working now!

Thank You!
Mitchell

anomie 11-01-2008 06:49 PM

Quote:

Originally Posted by robertjinx
Man look at additional include configuration files for apache, if especial
you install mtrg and apache from centos repo, I think they are in /etc/httpd/conf.d/mtrg.conf
or something like that.

Good catch. IIRC, rpms for webalizer, awstats, etc. on CentOS also install config files in conf.d.


All times are GMT -5. The time now is 06:44 PM.