I'm trying to run mozilla-firefox-sync-server with apache 2.4.17-3 on my Arch Linux server, following this guide. Here's a part of my /etc/httpd/conf/extra/httpd-vhosts.conf file.
<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>
When I curl ffsync.example.com, I get a 500 error. In the log, It looks like it's running with Python 3.5 (ImportError: No module named 'ConfigParser').
Indeed, if I replace syncserver.wsgi with the following sample code from the ArchWiki page on mod_wsgi:
#-*- 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
I get a 200 status code with 3.5.0 (default, Sep 20 2015, 11:28:25) [GCC 5.2.0].
When I use the package mod_wsgi2, everything works correctly, but I need to use mod_wsgi because there's also a Python 3 WSGI application running with Apache which cannot run with mod_wsgi2. The ArchWiki page on mod_wsgi states that mod_wsgi should work with Python 2 and 3.
What makes the python-path argument in the WSGIDaemonProcess directive ignored?
Update : Having a recent version of mod_wsgi (4.4.21-1), I also tried using python-home, like so:
WSGIDaemonProcess ffsyncs user=ffsync group=ffsync processes=2 threads=25 python-home=/opt/mozilla-firefox-sync-server/local/
This time, I get a 504 error and this message in the error log (whether original or modified syncserver.wsgi)
Timeout when reading response headers from daemon process 'ffsyncs': /opt/mozilla-firefox-sync-server/syncserver.wsgi
#!/usr/bin/env python,#!/usr/bin/env python2,#!/usr/bin/python2, nor#!/opt/mozilla/firefox-sync-server/local/bin/python2in the beginning ofsyncserver.wsgi(wether the original version or my version) change anything, it is still ran with Python 3 after restartinghttpd.mod_wsgiis for Python 3, not Python 2. However, there's one thing I haven't tried, that is compilingmod_wsgimyself from the instructions on the official website. If I recall correctly, it is supposed to handle both version of Python at the same time.WSGIPythonHomedirective? The documentation suggests that it's this directive that is used to tell Apache to use a certain Python executable. Thepython-pathoption toWSGIDaemonProcessis only for modifying the Python module search path.