【发布时间】:2017-03-16 08:33:21
【问题描述】:
我尝试配置 mod_wsgi 以将 apache Web 服务器与我的 django 1.9 (python 3.5) 应用程序集成。我正在开发 Centos7。 它工作正常,但客户抱怨性能很慢。加载主页需要一些时间。我是否缺少任何设置配置来提高性能? 我在 google 上读到 modwsgidaemonprocess 应该有更好的 fermormance 并且推荐配置?因此,我更改了 httpd.conf 添加以下行:
Alias '/static' '/home/elastic/workspace/ES_Brevetti/static'
<Directory '/home/elastic/workspace/ES_Brevetti/static'>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</Directory>
<Directory '/home/elastic/workspace/ES_Brevetti/ES_Brevetti'>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</Directory>
WSGIDaemonProcess ES_Brevetti python-path=/home/elastic/workspace/ES_Brevetti:/home/elastic/anaconda3/lib/python3.5/site-packages
WSGIProcessGroup ES_Brevetti
WSGIScriptAlias / /home/elastic/workspace/ES_Brevetti/ES_Brevetti/wsgi.py
但是注意到mod_wsgi-express_80脚本已经修改了httpd.conf,无法返回。
确实,当我尝试使用命令 systemctl start apache 启动 apache 时,我得到了错误: AH00111:配置变量 ${MOD_WSGI_MODULES_DIRECTORY} 未定义 httpd:/etc/httpd/conf/httpd.conf 的第 3 行语法错误:无法将 ${MOD_WSGI_MODULES_DIRECTORY}/mod_version.so 加载到服务器:/etc/httpd/${ MOD_WSGI_MODULES_DIRECTORY}/mod_version.so:无法打开共享对象文件:没有这样的文件或目录
有什么帮助吗??
Rgds 瓦莱里奥
【问题讨论】:
-
mod_wsgi-express脚本不应触及您现有的 Apache 安装。可能发生的唯一方法是,如果您错误地使用选项--server-root /etc/httpd/conf运行了mod_wsgi-express,那么您永远不应该这样做。如果你已经这样做了,你将不得不以某种方式卸载 Apache 及其配置文件并从系统包中重新安装它们以尝试将文件恢复到原始文件。另请注意,如果使用系统 Apache 并使用系统 mod_wsgi,则不需要 mod_wsgi_express。 -
服务器响应需要多长时间?服务器的负载是多少?服务器每秒收到多少个请求?
-
Thanx Graham,这是我的 httpd.conf 文件的顶部:
LoadModule version_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_version.so' ServerName localhost ServerRoot '/home/ elastic/mod_wsgi-express-80' PidFile '/home/elastic/mod_wsgi-express-80/httpd.pid'= 2.4> DefaultRuntimeDir '/home/elastic/mod_wsgi-express-80' ServerTokens ProductOnly ServerSignature Off 用户 ${MOD_WSGI_USER} 组 ${MOD_WSGI_GROUP} 哪个进程以这种方式修改了它?感谢您的帮助 -
嗨,Antonis,我们仍处于测试阶段,所以请求很少,但不会同时有 2 个请求。加载主页最多需要 10 秒(特别是使用 Internet Explorer)。
-
正如我之前所说,您已经完全搞砸了您的正常 Apache 配置,因为有人在不应该使用
--server-root /etc/httpd/conf选项时运行了 mod_wsgi-express。当一切设置正确时,没有理由为什么 mod_wsgi 的性能不能与 uWSGI 一样好或更好,但是您的 Apache 设置已经搞砸了。