
嘗試使用 mod_wsgi 和 Python3 來設定 apache
mod_wsgi配置
LoadModule wsgi_module /etc/httpd/mod_wsgi/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so
燒瓶應用程式配置
WSGIScriptAlias /test /var/www/FlaskApp/FlaskApp/flask_app.wsgi
<Directory /var/www/FlaskApp/FlaskApp/>
# set permissions as per apache2.conf file
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
ErrorLog /var/log/httpd/error.log
LogLevel warn
CustomLog /var/log/httpd/access.log combined
我使用 pip3 install mod_wsgi4.6.7.ta.gz 安裝了適用於 Python3 的 mod_wsgi。
mod_wsgi.so 對於 Python2.7 有效,但對於 Python3.6.6 它會忽略 loadmodule 指令。
上面是設定一個處理restapi的Flask應用程式。