我目前正在尝试按照此页面https://github.com/GrahamDumpleton/mod_wsgi中的步骤在python中安装mod_wsgi(似乎是官方页面)。
使用pip install mod_wsgi
安装后,我输入命令mod_wsgi-express start-server
以检查它是否运行。
似乎没有运行,我有一个错误:
root@vpsxxxx:/# mod_wsgi-express start-server
Server URL : http://localhost:8000/
Server Root : /tmp/mod_wsgi-localhost:8000:0
Server Conf : /tmp/mod_wsgi-localhost:8000:0/httpd.conf
Error Log : /tmp/mod_wsgi-localhost:8000:0/error_log
AH00534: apache2: Configuration error: More than one MPM loaded.
正如您所看到的,我是根,但如果我mod_wsgi-express start-server wsgi.py --port=80 --user www-data --group www-data
,我会遇到同样的错误。
有什么想法吗?
修改: 安装过程中可能存在问题:
/usr/include/python2.7/object.h:822:38: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]
root@vpsxxxx:~# pip install mod_wsgi
Downloading/unpacking mod-wsgi
Downloading mod_wsgi-4.2.1.tar.gz (1.1MB): 1.1MB downloaded
Running setup.py (path:/tmp/pip_build_root/mod-wsgi/setup.py) egg_info for package mod-wsgi
Downloading/unpacking mod-wsgi-metrics>=1.0.0 (from mod-wsgi)
Downloading mod_wsgi-metrics-1.0.0.tar.gz
Running setup.py (path:/tmp/pip_build_root/mod-wsgi-metrics/setup.py) egg_info for package mod-wsgi-metrics
Installing collected packages: mod-wsgi, mod-wsgi-metrics
Running setup.py install for mod-wsgi
building 'mod_wsgi.server.mod_wsgi-py27' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_daemon.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_daemon.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_stream.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_stream.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_apache.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_apache.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/mod_wsgi.c -o build/temp.linux-x86_64-2.7/src/server/mod_wsgi.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
In file included from /usr/include/python2.7/Python.h:80:0,
from src/server/wsgi_python.h:24,
from src/server/mod_wsgi.c:22:
src/server/mod_wsgi.c: In function ‘Dispatch_ssl_var_lookup’:
/usr/include/python2.7/object.h:822:38: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]
#define Py_XINCREF(op) do { if ((op) == NULL) ; else Py_INCREF(op); } while (0)
^
src/server/mod_wsgi.c:5555:9: note: in expansion of macro ‘Py_XINCREF’
Py_XINCREF(Py_None);
^
/usr/include/python2.7/object.h:822:38: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]
#define Py_XINCREF(op) do { if ((op) == NULL) ; else Py_INCREF(op); } while (0)
^
src/server/mod_wsgi.c:5564:9: note: in expansion of macro ‘Py_XINCREF’
Py_XINCREF(Py_None);
^
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_logger.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_logger.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_convert.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_convert.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_metrics.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_metrics.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_restrict.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_restrict.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_server.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_server.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_validate.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_validate.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_interp.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_interp.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_buckets.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_buckets.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
src/server/wsgi_buckets.c: In function ‘wsgi_python_bucket_setaside’:
src/server/wsgi_buckets.c:151:5: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘apr_off_t’ [-Wformat=]
fprintf(stderr, "start=%lld\n", b->start);
^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/server/wsgi_daemon.o build/temp.linux-x86_64-2.7/src/server/wsgi_stream.o build/temp.linux-x86_64-2.7/src/server/wsgi_apache.o build/temp.linux-x86_64-2.7/src/server/mod_wsgi.o build/temp.linux-x86_64-2.7/src/server/wsgi_logger.o build/temp.linux-x86_64-2.7/src/server/wsgi_convert.o build/temp.linux-x86_64-2.7/src/server/wsgi_metrics.o build/temp.linux-x86_64-2.7/src/server/wsgi_restrict.o build/temp.linux-x86_64-2.7/src/server/wsgi_server.o build/temp.linux-x86_64-2.7/src/server/wsgi_validate.o build/temp.linux-x86_64-2.7/src/server/wsgi_interp.o build/temp.linux-x86_64-2.7/src/server/wsgi_buckets.o -o build/lib.linux-x86_64-2.7/mod_wsgi/server/mod_wsgi-py27.so -L/usr/lib -L/usr/lib/python2.7/config -lpython2.7
Installing mod_wsgi-express script to /usr/local/bin
Running setup.py install for mod-wsgi-metrics
Successfully installed mod-wsgi mod-wsgi-metrics
Cleaning up...
末日。
答案 0 :(得分:1)
Graham Dumpleton刚刚更新了回购并处理了这个问题,所以请考虑更新你的python mod_wsgi模块,这将解决你的问题。
在后端运行mod-wsgi模块的python代码试图在添加了一个MPM之后添加多个MPM,而不是按预期的方式突破循环。
这是有问题的代码
def _mpm_module_defines(modules_directory):
result = []
workers = ['event', 'worker', 'prefork']
for name in workers:
if os.path.exists(os.path.join(modules_directory,
'mod_mpm_%s.so' % name)):
result.append('-DWSGI_MPM_%s_MODULE' % name.upper())
return result
在系统上安装了多个Apache mods(event和worker和prefork)时,没有考虑代码。代码现在在追加后有一个“中断”。