安装Graphite 1.2版后,Apache2不会重启

时间:2018-01-18 09:26:35

标签: python apache mod-wsgi graphite graphite-carbon

我刚刚安装了Graphite(版本1.2.0),但我无法再次启动Apache2。这是我得到的错误日志:

 * The apache2 configtest failed.
Output of config test was:
[Thu Jan 18 20:12:39.906483 2018] [so:warn] [pid 2356] AH01574: module wsgi_module is already loaded, skipping
AH00526: Syntax error on line 56 of /etc/apache2/sites-enabled/apache2-graphite.conf:
WSGI process group not yet configured.
Action 'configtest' failed.
The Apache error log may have more information.

这是我的apache2-graphite.conf文件:

LoadModule wsgi_module modules/mod_wsgi.so

WSGISocketPrefix /var/run/wsgi

Listen 80

<VirtualHost *:80>

 DocumentRoot /var/www/html
 <Directory />
 Options FollowSymLinks
 AllowOverride None
 </Directory>
 <Directory /var/www/html>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all
 </Directory>

 ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
 <Directory "/usr/lib/cgi-bin">
 AllowOverride None
 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
 Order allow,deny
 Allow from all
 </Directory>

 ErrorLog /var/log/apache2/error.log

 # Possible values include: debug, info, notice, warn, error, crit,
 # alert, emerg.
 LogLevel warn

 CustomLog /var/log/apache2/access.log combined

 Alias /doc/ "/usr/share/doc/"
 <Directory "/usr/share/doc/">
 Options Indexes MultiViews FollowSymLinks
 AllowOverride None
 Order deny,allow
 Deny from all
 Allow from 127.0.0.0/255.0.0.0 ::1/128
 </Directory>

</VirtualHost>

<VirtualHost *:3020>

WSGIDaemonProcess graphite-web processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 user=_graphite group=_graphite

WSGIProcessGroup graphite-web

WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphite-api application-group=%{GLOBAL}

WSGIScriptAlias /graphite /opt/graphite/conf/graphite.wsgi/graphite
Alias /graphite/static /opt/graphite/webapp/content

 Alias /content/ /usr/share/graphite-web/static/
 <Location "/content/">
 SetHandler None
 </Location>

 <Location "/server-status">
 SetHandler server-status
 Require all granted
 </Location>

 ErrorLog ${APACHE_LOG_DIR}/graphite-web_error.log

 # Possible values include: debug, info, notice, warn, error, crit,
 # alert, emerg.
 LogLevel warn

 CustomLog ${APACHE_LOG_DIR}/graphite-web_access.log combined

</VirtualHost>

我真的不知道如何修复此错误。我不知道应该在哪里配置进程组。我很感激任何提示。

我们在Ubuntu 14.04上使用Python 2.7和mod_wsgi 2.7。我们的Apache2版本是2.4.7。

提前感谢!

编辑:我注意到一些奇怪的事情,我不知道它是否相关。在Apache2 error.log中,我找到了这一行:

[Thu Jan 18 18:00:38.112219 2018] [mpm_prefork:notice] [pid 30731] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.20 OpenSSL/1.0.1f mod_wsgi/3.4 Python/2.7.6 configured -- resuming normal operations

它显示mod_wsgi配置了3.4版本,但实际上,当我运行ls -l /usr/lib/apache2/modules | grep wsgi时,我发现该机器运行的是2.7版本。

lrwxrwxrwx 1 root root      15 Nov 19  2014 mod_wsgi.so -> mod_wsgi.so-2.7
-rw-r--r-- 1 root root  170216 Nov 19  2014 mod_wsgi.so-2.7

2 个答案:

答案 0 :(得分:0)

1.2尚未发布,最好使用1.1.1

<ul class="sublist"> <strong> Utilisateurs </strong> <li><a target="_blank" href="{% url "admin:auth_user_add" %}">Nouvel utilisateur</a></li> <li><a target="_blank" href="{% url "admin:auth_user_changelist" %}">Liste utilisateurs</a></li> </ul> <ul class="sublist"> <strong> Groupes </strong> <li><a target="_blank" href="{% url "admin:auth_group_add" %}">Nouveau groupe</a></li> <li><a target="_blank" href="{% url "admin:auth_group_changelist" %}">Liste groupes</a></li> </ul>

应该是:

WSGIScriptAlias /graphite /opt/graphite/conf/graphite.wsgi/graphite

答案 1 :(得分:0)

它会出现该错误,因为您为WSGIDaemonProcess指定的名称是错误的,并且与WSGIApplicationGroup定义的名称不匹配。你也错过了一个WSGIImportScript指令,就像你试图设置它一样。无论如何,最好不要使用WSGIDaemonProcess graphite-web processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 user=_graphite group=_graphite WSGIProcessGroup graphite-web WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphite-api application-group=%{GLOBAL} WSGIScriptAlias /graphite /opt/graphite/conf/graphite.wsgi/graphite

所以你有:

WSGIDaemonProcess graphite-web processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 user=_graphite group=_graphite

WSGIScriptAlias /graphite /opt/graphite/conf/graphite.wsgi/graphite process-group=graphite-web application-group=%{GLOBAL}

您应该使用:

/graphite

/graphite只应添加到WSGI脚本文件路径的末尾,如果石墨中的路由规则总是希望它的路径在开始时包含{{1}},但是你无法挂载它位于站点的根目录,但需要在子URL处使用它,因为其他东西在同一主机名上运行。