mod_wsgiとApacheはpython-pathを無視します。

mod_wsgiとApacheはpython-pathを無視します。

走ろうとしています。mozilla-firefox-同期サーバー次のように、Arch LinuxサーバーでApache 2.4.17-3を使用します。このガイド。これは私のファイルの一部です/etc/httpd/conf/extra/httpd-vhosts.conf

<Directory /opt/mozilla-firefox-sync-server>
    Require all granted
</Directory>

<VirtualHost *:80>
    ServerName ffsync.example.com
    DocumentRoot /opt/mozilla-firefox-sync-server/

    WSGIProcessGroup ffsyncs
    WSGIDaemonProcess ffsyncs user=ffsync group=ffsync processes=2 threads=25 python-path=/opt/mozilla-firefox-sync-server/local/lib/python2.7/site-packages/
    WSGIPassAuthorization On
    WSGIScriptAlias / /opt/mozilla-firefox-sync-server/syncserver.wsgi
    CustomLog /var/log/httpd/ffsync_custom combined
    ErrorLog /var/log/httpd/ffsync_error
</VirtualHost>

これを行うと、curl ffsync.example.com500 エラーが発生します。ログを見ると、ImportError: No module named 'ConfigParser'Python 3.5()で実行されているようです。

実際、syncserver.wsgi次のサンプルコードmod_wsgiのArchWikiページ:

#-*- coding: utf-8 -*-
def wsgi_app(environ, start_response):
    import sys
    output = sys.version.encode('utf8')
    status = '200 OK'
    headers = [('Content-type', 'text/plain'),
               ('Content-Length', str(len(output)))]
    start_response(status, headers)
    yield output

application = wsgi_app

200ステータスコードを受け取りました3.5.0 (default, Sep 20 2015, 11:28:25) [GCC 5.2.0]

これらのパッケージを使用すると、すべてがうまく機能しますが、Apacheで動作しないPython 3 WSGIアプリケーションもあるため、mod_wsgi2それを使用する必要があります。mod_wsgimod_wsgi2mod_wsgiのArchWikiページ宣言はmod_wsgiPython 2と3で使用する必要があります。

python-pathディレクティブの引数WSGIDaemonProcessが無視される原因は何ですか?

修正する:最新バージョンmod_wsgi(4.4.21-1)を使用しながら、次のように試しましたpython-home

WSGIDaemonProcess ffsyncs user=ffsync group=ffsync processes=2 threads=25 python-home=/opt/mozilla-firefox-sync-server/local/

今回は、エラーログ(元または修正済みsyncserver.wsgi)にこのメッセージとともに504エラーが表示されます。

Timeout when reading response headers from daemon process 'ffsyncs': /opt/mozilla-firefox-sync-server/syncserver.wsgi

ベストアンサー1

私も同じTimeout when reading response headers from daemon process問題があります。 Apacheのデフォルトログファイル(VirtualHostのログファイルではない)に、次のエラーが表示されます。

Unable to change working directory to '/home/ffsync'.
Failure to configure the daemon process correctly and process left in unspecified state. Restarting daemon process after delay.

ホームディレクトリがffsync存在しないことがわかりました。それを変更すると、/opt/mozilla-firefox-sync-server/私の問題は解決しました。おそらくそれはあなたにも役立ちます!

おすすめ記事