16

I'm trying to set up graphite on my Mac OS X 10.7 lion, i've set up apache to call the python graphite script via WSGI, but when i try to access it, i get a forbiden from apache and in the error log.

 "client denied by server configuration: /opt/graphite/webapp/graphite.wsgi"

I've checked that the scripts location is allowed in httpd.conf, and the permissions of the file, but they seem correct. What do i have to do to get access. Below is the httpd.conf, which is nearly the graphite example.

<IfModule !wsgi_module.c>
   LoadModule wsgi_module modules/mod_wsgi.so
</IfModule>
WSGISocketPrefix /usr/local/apache/run/wigs   
<VirtualHost _default_:*>
    ServerName graphite
    DocumentRoot "/opt/graphite/webapp"
    ErrorLog /opt/graphite/storage/log/webapp/error.log
    CustomLog /opt/graphite/storage/log/webapp/access.log common
    WSGIDaemonProcess graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120
    WSGIProcessGroup graphite
    WSGIApplicationGroup %{GLOBAL}
    WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphite application-group=%{GLOBAL}
    # XXX You will need to create this file! There is a graphite.wsgi.example
    # file in this directory that you can safely use, just copy it to graphite.wgsi
    WSGIScriptAlias / /opt/graphite/webapp/graphite.wsgi
    Alias /content/ /opt/graphite/webapp/content/
    <Location "/content/">
            SetHandler None
    </Location>
    # XXX In order for the django admin site media to work you
    Alias /media/ "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-   packages/django/contrib/admin/media/"
    <Location "/media/">
            SetHandler None
    </Location>
    # The graphite.wsgi file has to be accessible by apache. 
    <Directory "/opt/graphite/webapp/">
            Options +ExecCGI
            Order deny,allow
            Allow from all
    </Directory>
</VirtualHost>

Can you help?

Dr BDO Adams
  • 231
  • 1
  • 2
  • 7

4 Answers4

26

Since apache 2.4, Require all granted is required:

<Directory /opt/graphite/conf>
    Require all granted
</Directory>

Up to apache 2.2, you would write:

<Directory /opt/graphite/conf>
    Order deny,allow
    Allow from all
</Directory>

See upgrading notes.

Note that you can activate mod_access_compat to use old (pre 2.4) directives in apache 2.4. It might be useful if you want to quickly rule out this as the cause for your initial issue, but frankly, the migration to Require is easy enough, there is not point using this module just to postpone it.

Jérôme
  • 565
  • 1
  • 5
  • 18
Bwire
  • 361
  • 3
  • 5
4

http://wiki.apache.org/httpd/ClientDeniedByServerConfiguration

It is always one of those reasons.

adaptr
  • 16,479
  • 21
  • 33
0

You are missing:

<Directory /opt/graphite/webapp>
Order deny,allow
Allow from all
</Directory>

<Directory /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-   packages/django/contrib/admin/media>
Order deny,allow
Allow from all
</Directory>

You also don't need:

<Location "/content/">
        SetHandler None
</Location>
<Location "/media/">
        SetHandler None
</Location>

That 'SetHandler None' stuff is old mod_python stuff and not needed for mod_wsgi.

Graham Dumpleton
  • 5,990
  • 2
  • 20
  • 19
  • 1
    Is the `media` alias & `` necessary? The only `contrib/admin` directory I can find in my Django 1.4 installation doesn't contain a `media` subdir. – Richard Barnett May 01 '13 at 02:57
  • Don't assume your issue is the same. Post a fresh question with all your specific details. – Graham Dumpleton May 01 '13 at 03:19
  • Thanks, Graham; I don't actually have an issue as Graphite seems to be working fine when including the `media` alias & ``. I'll ask a fresh question if it hits problems. – Richard Barnett May 02 '13 at 00:25
0

Setting execute permissions fixed it for me:

chmod u+x graphite.wsgi
Gerry
  • 338
  • 2
  • 3
  • 12