-1

我刚刚安装了 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
4

2 回答 2

0

1.2还没有发布,最好使用1.1.1

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

应该:

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

于 2018-01-18T10:18:23.267 回答
0

它给出了该错误,因为您给出的名称WSGIImportSript是错误的并且与定义的名称不匹配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}

应该只在 WSGI 脚本文件路径的/graphite末尾添加,如果石墨中的路由规则总是期望它/graphite在开始时包含它的路径,但你不能将它安装在站点的根目录,但需要它在子 URL,因为其他东西在相同的主机名上运行。

于 2018-01-18T11:03:33.373 回答