LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Add folder access to Apache conf (https://www.linuxquestions.org/questions/linux-server-73/add-folder-access-to-apache-conf-530828/)

quilop 02-20-2007 04:06 PM

Add folder access to Apache conf
 
Hi, I have a Nagios installation on my server running with Apache 2.0 and I have tried to install and configure NagiosGrapher on it. My problem is that I am having problems with the graphics, and it seems that the issue relays on Apache having problems to access a font. What I want to know is how to add an apache readable folder in .httpd.conf

I want Apache to be able to read /usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf

I am not using .htaccess and I have tried the following without success:

<Directory "/usr/share/rrdtool/fonts/">
Options All
AllowOverride None
Order allow,deny
Allow from all
</Directory>

I am getting an error on apache error log that says:

"Can't find font /usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf"

Any advice or tips are most welcome.
Thanks

bathory 02-21-2007 01:05 PM

You can use the Alias directive:
Code:

Alias /fonts /usr/share/rrdtool/fonts
Also change the <Directory "/usr/share/rrdtool/fonts/"> to <Directory "/fonts">
This way when you give the URL: http://www.domain.com/fonts/DejaVuSansMono-Roman.ttf, apache will use the correct path to show the font. If your URL is different change the first part of the Alias directive accordingly.

quilop 02-22-2007 03:29 PM

Thanks for the reply. Actually I am not trying to view the font from any WEB client. I am trying to use an auto grapher, and this autographer uses rrdtool to create the graphics. At some point when I click a link on my site, that link execute a CGI and the CGI is making a call to /usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf It is here where Apache complains telling that the file can not be found, even when it is there, and all the folder access are available to the world.

That is why Im looking to giving apache the rights to read a folder outside the "htdocs" where my WEB page is located in.

Any ideas?

Thanks

quilop 02-22-2007 04:05 PM

I tried adding the Alias like this:

Alias /nagios/fonts/ /usr/share/rrdtool/fonts/
<Directory "/usr/share/rrdtool/fonts/">
AllowOverride AuthConfig
Options MultiViews
Order allow,deny
Allow from all
</Directory>

Reloading apache, and when I try to access localhost/nagios/fonts y get a "You dont have permission to access /nagios/fonts" error message.

Maybe is just an easy config setting in httpd.conf file that I am not aware of. Any suggestions?

bathory 02-23-2007 02:11 AM

You can try a few things:
1. Make sure the that folder /usr/share/rrdtool/fonts is world executable, to avoid the ""You dont have permission to access /nagios/fonts" error message.
2. If the cgi is a perl script you can edit it and change the path to the font to DocumentRoot. Then copy the font inside the DocumentRoot.
3. Create a symlink to /usr/share/rrdtool/fonts somewhere inside DocumentRoot:
Code:

ln -s /usr/share/rrdtool/fonts /var/www/html/fonts
and use "Options FollowSymlins" for that directory:
Code:

<Directory "/var/www/html/fonts/">
Options FollowSymlinks
AllowOverride Options
Order allow,deny
Allow from all
</Directory>


quilop 02-23-2007 03:07 PM

Ok, I have alerady tried the first option, it has full access (chmod 777) and still nothing. The second one, sadly, I am not sure what CGI is the one who is calling for the font, I thought it was my NagiosGrapher, but I changed the settings, recompiled the app with the new settings, there is a place where "supposedly" you can enter a different font path, but apache is still looking for the font on the path we are talking about, so I guess this is not a good one.

And I tried the third one, this one looked that was going to solve my drama

3. Create a symlink to /usr/share/rrdtool/fonts somewhere inside DocumentRoot:
Code:

ln -s /usr/share/rrdtool/fonts /var/www/html/fonts

and use "Options FollowSymlins" for that directory:
Code:

<Directory "/var/www/html/fonts/"> Options FollowSymlinks AllowOverride Options Order allow,deny Allow from all </Directory>

But Apache is still sending the error message.

I made a little test, if I put the following alias:

Code:
Alias /nagios/fonts/ /usr/local/typo3/htdocs/nagios/fonts/
<Directory "/usr/local/typo3/htdocs/nagios/fonts/">
AllowOverride AuthConfig
Options MultiViews
Order allow,deny
Allow from all
</Directory>

I can access the folder /nagios/fonts without problems, but, if I put the following alias:

Code:
Alias /nagios/fonts/ /usr/share/rrdtool/fonts/
<Directory "/usr/share/rrdtool/fonts/">
AllowOverride AuthConfig
Options MultiViews
Order allow,deny
Allow from all
</Directory>

I get the "403 Forbidden, you dont have permission to access /nagios/fonts/ on this server" message on the WEB browser.

This is why I am thinking that Apache does not have permission to access any path outside its server route. The server route is /usr/local/typo3/htdocs/
Any doc inside here can be accessed, any other outside this rouse cant, no matter if I change folder permissions, alias, create links, etc.

Is there a way to tell Apache to access a folder no matter if it is outside of its server path? Is there something else I can try??

bathory 02-24-2007 07:49 AM

Using symlink should have worked as the Alias option too. You can read http://httpd.apache.org/docs/2.0/urlmapping.html how you can access pages outside DocumentRoot.
Perhaps your distro uses SELinux and that is the reason you cannot access anything outside DocumentRoot. If that's the case change SELinux settings, or disable it to see if apache works as expected.


All times are GMT -5. The time now is 03:56 AM.