访问wsgi石墨脚本时拒绝客户端


16

我正在尝试在Mac OS X 10.7 Lion上设置石墨,我已经设置了apache通过WSGI调用python石墨脚本,但是当我尝试访问它时,我从apache中获取了禁止信息,并且在错误日志中。

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

我检查了httpd.conf中是否允许脚本位置以及文件的权限,但是它们似乎正确。我需要做什么才能获得访问权限。下面是httpd.conf,几乎是石墨示例。

<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>

你能帮我吗?

Answers:


24

从apache 2.4开始,Require all granted需要:

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

在apache 2.2之前,您应该这样写:

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

请参阅升级说明

请注意,您可以激活mod_access_compat以在Apache 2.4中使用旧的(2.4之前的)指令。如果您想快速排除这是造成最初问题的原因,这可能会很有用,但是坦率地说,迁移Require到此过程很容易,仅使用该模块来推迟它是没有意义的。


3
您可能只需要Require all granted
chrishiestand


0

您不见了:

<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>

您也不需要:

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

'SetHandler None'的东西是旧的mod_python的东西,而mod_wsgi则不需要。


1
media别名:<Directory>有必要吗?contrib/admin我在Django 1.4安装中可以找到的唯一目录不包含media子目录。
理查德·巴内特

不要以为您的问题是一样的。发表一个新的问题,其中包含您所有的详细信息。
Graham Dumpleton

谢谢,格雷厄姆;我实际上没有问题,因为当包含media别名&时,Graphite似乎运行良好<Directory>。我会问一个新的问题,如果遇到问题。
理查德·巴内特

0

设置执行权限已为我修复:

chmod u+x graphite.wsgi
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.