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?

24

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.

  • 3
    You may only need Require all granted – chrishiestand Aug 15 '14 at 9:29
4

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

It is always one of those reasons.

  • 1
    Sometimes it's necessary to remind the obvious. For me, it was a wrong path in <Directory>. – Victor Sergienko Aug 26 '15 at 14:11
  • The link 404s... – JohnJ Aug 24 '18 at 15:58
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.

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

Setting execute permissions fixed it for me:

chmod u+x graphite.wsgi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.