在OS-X Lion上安装Graphite。如何配置apache2?

3 投票
2 回答
1659 浏览
提问于 2025-04-17 00:02

我正在尝试在本地配置Graphite。说明书写得很简单,容易理解,直到要配置apache2的部分,说明就变得模糊了,而且那些选项似乎都不适用于OS-X。我下载的Graphite源代码没有提供安装指南中提到的“vhost.conf”示例,而我的apache2目录(/etc/apache2)里也没有说明书提到的这些目录:sites-available、sites-enabled、/conf/vhosts.d/。

我需要自己创建这些目录吗?如果需要,创建后我应该放些什么进去?我该如何修改httpd.conf,除了允许mod_python之外?抱歉,这可能是最基础的apache问题,但我之前从来没有做过这些!

2 个回答

0

试试这个:

LoadModule wsgi_module /usr/libexec/apache2/mod_wsgi.so
<IfModule !wsgi_module.c>
        LoadModule wsgi_module /usr/libexec/apache2/mod_wsgi.so
</IfModule>
WSGISocketPrefix /var/run/apache2/wsgi
<VirtualHost *:80>
        ServerName graphite.local
        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 python-path=/opt/graphite/lib/python2.7/site-packages/
        WSGIProcessGroup graphite
        WSGIApplicationGroup %{GLOBAL}
        WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphite application-group=%{GLOBAL}
        WSGIScriptAlias / /opt/graphite/conf/graphite.wsgi 
        Alias /content/ /opt/graphite/webapp/content/
        <Location "/content/">
                SetHandler None
                Order allow,deny
                Allow from localhost
        </Location>
        Alias /media/ "@DJANGO_ROOT@/contrib/admin/media/"
        <Location "/media/">
                SetHandler None
        </Location>
        <Directory /opt/graphite/conf/>
                Order deny,allow
                Allow from all
        </Directory>
</VirtualHost>
4

有一个脚本可以用来启动一个简单的开发服务器,这个脚本是和graphite一起提供的。我把graphite安装在了/opt/graphite目录下,所以这个脚本的路径是/opt/graphite/bin/run-graphite-devel-server.py

使用方法:

run-graphite-devel-server.py /path/to/graphite/install

例如:

/opt/graphite/bin/run-graphite-devel-server.py /opt/graphite  

补充说明:有很多额外的功能并没有包含在发布的包里,但如果你从他们的源代码库下载graphite,这些功能就会包含在内。虽然这样做稍微有点复杂(不过如果你使用他们的github镜像,实际上并不太难),我建议你从源代码构建graphite。(感谢@jabley提到这些功能不在发布的压缩包里)。

撰写回答