【发布时间】:2018-01-18 09:26:35
【问题描述】:
我刚刚安装了 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
【问题讨论】:
-
日志中的 3.4 是 mod_wsgi 3.4,而不是 Python 3.4。 mod_wsgi 对象名称中的 2.7 表示 Python 2.7。您不应该使用 mod_wsgi 3.4,因为它绝对是古老的。不要使用您的 Ubuntu 为 mod_wsgi 提供的系统包,因为它们不受支持并且总是过时多年,在这种情况下超过 5 年。
标签: python apache mod-wsgi graphite graphite-carbon