【发布时间】:2017-10-26 21:16:09
【问题描述】:
我有一个与 Apache 和 mod_wsgi 一起使用的 Python webapp(使用 Flask)。现在,只要我启动 Apache,我就会看到启动了 4 个 Apache 进程(参见下面的 htop 屏幕截图)。
现在,根据对应用程序的 POST 请求,我看到其中一个进程正在运行,而其他进程则什么也不做。接下来的几个 POST 请求(介于 2 到 5 个请求之间)仍然发送到第一个进程,但之后使用了第二个进程,这让我遇到了内存问题。你能告诉我如何防止这种情况发生吗?这是我的 Apache 配置文件:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName mydomain.com
ServerAlias www.mydomain.com
ServerAdmin admin@mydomain.com
DocumentRoot /var/www/html
WSGIScriptAlias /myapp /var/www/wsgi-scripts/myapp.wsgi
ErrorLog ${APACHE_LOG_DIR}/myapp.error.log
CustomLog ${APACHE_LOG_DIR}/myapp.access.log combined
# I tried with commenting and un-commenting this, same result
<Directory /var/www/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
RewriteEngine on
tps://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
【问题讨论】:
标签: apache flask mod-wsgi wsgi