【问题标题】:Installing Graphite on OS-X Lion. How to configure apache2?在 OS-X Lion 上安装 Graphite。如何配置apache2?
【发布时间】:2026-01-07 02:35:02
【问题描述】:
我正在尝试在本地配置石墨。这些说明非常直接且易于遵循(see here),直到关于配置 apache2 的部分,说明变得模糊,并且似乎没有一个选项适用于 OS-X。下载石墨源没有提供安装指南中描述的示例“vhost.conf”,并且我的 apache2 目录(/etc/apache2)没有以下任何目录,说明可能是选项:sites-available、sites-启用,/conf/vhosts.d/
我需要创建这些目录吗?如果是这样,一旦它们被创建,我会放在那里。除了允许 mod_python 之外,我如何修改 httpd.conf?抱歉,这可能是最基本的 apache 问题,但我以前从未这样做过!
【问题讨论】:
标签:
python
macos
apache2
graphite
【解决方案1】:
有一个脚本可以启动一个包含在石墨中的简单开发服务器。我已将石墨安装到/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
edit:有很多 很多 未包含在发布包中,但如果您从其源存储库中查看石墨,则会包含在内。即使它有点困难(虽然如果你使用他们的 bazaar repo 的 github 镜像并不太难),我建议从源代码构建石墨。 (感谢@jabley 提到它不在发布压缩包中)。
【解决方案2】:
试试这个:
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>