mod_wsgi with Apache ignoring python-path











up vote
2
down vote

favorite












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









share|improve this question
























  • I am looking at syncserver.wsgi in github. SHould it not have as first line #!/usr/bin/env python ? It is not there...
    – Rui F Ribeiro
    Nov 22 '15 at 12:53










  • Neither #!/usr/bin/env python, #!/usr/bin/env python2, #!/usr/bin/python2, nor #!/opt/mozilla/firefox-sync-server/local/bin/python2 in the beginning of syncserver.wsgi (wether the original version or my version) change anything, it is still ran with Python 3 after restarting httpd.
    – GeoffreyFrogeye
    Nov 22 '15 at 13:22








  • 1




    Did you find any solution for this problem? I am facing the very same issue at the moment
    – CharlyDelta
    Nov 23 '16 at 13:35










  • Sadly not, I have given up. Looks like Arch Linux package mod_wsgi is for Python 3, not Python 2. However, there's one thing I haven't tried, that is compiling mod_wsgi myself from the instructions on the official website. If I recall correctly, it is supposed to handle both version of Python at the same time.
    – GeoffreyFrogeye
    Nov 24 '16 at 15:53










  • Have you tried using the WSGIPythonHome directive? The documentation suggests that it's this directive that is used to tell Apache to use a certain Python executable. The python-path option to WSGIDaemonProcess is only for modifying the Python module search path.
    – Psychonaut
    Nov 4 '17 at 12:04















up vote
2
down vote

favorite












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









share|improve this question
























  • I am looking at syncserver.wsgi in github. SHould it not have as first line #!/usr/bin/env python ? It is not there...
    – Rui F Ribeiro
    Nov 22 '15 at 12:53










  • Neither #!/usr/bin/env python, #!/usr/bin/env python2, #!/usr/bin/python2, nor #!/opt/mozilla/firefox-sync-server/local/bin/python2 in the beginning of syncserver.wsgi (wether the original version or my version) change anything, it is still ran with Python 3 after restarting httpd.
    – GeoffreyFrogeye
    Nov 22 '15 at 13:22








  • 1




    Did you find any solution for this problem? I am facing the very same issue at the moment
    – CharlyDelta
    Nov 23 '16 at 13:35










  • Sadly not, I have given up. Looks like Arch Linux package mod_wsgi is for Python 3, not Python 2. However, there's one thing I haven't tried, that is compiling mod_wsgi myself from the instructions on the official website. If I recall correctly, it is supposed to handle both version of Python at the same time.
    – GeoffreyFrogeye
    Nov 24 '16 at 15:53










  • Have you tried using the WSGIPythonHome directive? The documentation suggests that it's this directive that is used to tell Apache to use a certain Python executable. The python-path option to WSGIDaemonProcess is only for modifying the Python module search path.
    – Psychonaut
    Nov 4 '17 at 12:04













up vote
2
down vote

favorite









up vote
2
down vote

favorite











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









share|improve this question















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






arch-linux apache-httpd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 17 at 23:29









Rui F Ribeiro

38.7k1479128




38.7k1479128










asked Nov 22 '15 at 12:44









GeoffreyFrogeye

709




709












  • I am looking at syncserver.wsgi in github. SHould it not have as first line #!/usr/bin/env python ? It is not there...
    – Rui F Ribeiro
    Nov 22 '15 at 12:53










  • Neither #!/usr/bin/env python, #!/usr/bin/env python2, #!/usr/bin/python2, nor #!/opt/mozilla/firefox-sync-server/local/bin/python2 in the beginning of syncserver.wsgi (wether the original version or my version) change anything, it is still ran with Python 3 after restarting httpd.
    – GeoffreyFrogeye
    Nov 22 '15 at 13:22








  • 1




    Did you find any solution for this problem? I am facing the very same issue at the moment
    – CharlyDelta
    Nov 23 '16 at 13:35










  • Sadly not, I have given up. Looks like Arch Linux package mod_wsgi is for Python 3, not Python 2. However, there's one thing I haven't tried, that is compiling mod_wsgi myself from the instructions on the official website. If I recall correctly, it is supposed to handle both version of Python at the same time.
    – GeoffreyFrogeye
    Nov 24 '16 at 15:53










  • Have you tried using the WSGIPythonHome directive? The documentation suggests that it's this directive that is used to tell Apache to use a certain Python executable. The python-path option to WSGIDaemonProcess is only for modifying the Python module search path.
    – Psychonaut
    Nov 4 '17 at 12:04


















  • I am looking at syncserver.wsgi in github. SHould it not have as first line #!/usr/bin/env python ? It is not there...
    – Rui F Ribeiro
    Nov 22 '15 at 12:53










  • Neither #!/usr/bin/env python, #!/usr/bin/env python2, #!/usr/bin/python2, nor #!/opt/mozilla/firefox-sync-server/local/bin/python2 in the beginning of syncserver.wsgi (wether the original version or my version) change anything, it is still ran with Python 3 after restarting httpd.
    – GeoffreyFrogeye
    Nov 22 '15 at 13:22








  • 1




    Did you find any solution for this problem? I am facing the very same issue at the moment
    – CharlyDelta
    Nov 23 '16 at 13:35










  • Sadly not, I have given up. Looks like Arch Linux package mod_wsgi is for Python 3, not Python 2. However, there's one thing I haven't tried, that is compiling mod_wsgi myself from the instructions on the official website. If I recall correctly, it is supposed to handle both version of Python at the same time.
    – GeoffreyFrogeye
    Nov 24 '16 at 15:53










  • Have you tried using the WSGIPythonHome directive? The documentation suggests that it's this directive that is used to tell Apache to use a certain Python executable. The python-path option to WSGIDaemonProcess is only for modifying the Python module search path.
    – Psychonaut
    Nov 4 '17 at 12:04
















I am looking at syncserver.wsgi in github. SHould it not have as first line #!/usr/bin/env python ? It is not there...
– Rui F Ribeiro
Nov 22 '15 at 12:53




I am looking at syncserver.wsgi in github. SHould it not have as first line #!/usr/bin/env python ? It is not there...
– Rui F Ribeiro
Nov 22 '15 at 12:53












Neither #!/usr/bin/env python, #!/usr/bin/env python2, #!/usr/bin/python2, nor #!/opt/mozilla/firefox-sync-server/local/bin/python2 in the beginning of syncserver.wsgi (wether the original version or my version) change anything, it is still ran with Python 3 after restarting httpd.
– GeoffreyFrogeye
Nov 22 '15 at 13:22






Neither #!/usr/bin/env python, #!/usr/bin/env python2, #!/usr/bin/python2, nor #!/opt/mozilla/firefox-sync-server/local/bin/python2 in the beginning of syncserver.wsgi (wether the original version or my version) change anything, it is still ran with Python 3 after restarting httpd.
– GeoffreyFrogeye
Nov 22 '15 at 13:22






1




1




Did you find any solution for this problem? I am facing the very same issue at the moment
– CharlyDelta
Nov 23 '16 at 13:35




Did you find any solution for this problem? I am facing the very same issue at the moment
– CharlyDelta
Nov 23 '16 at 13:35












Sadly not, I have given up. Looks like Arch Linux package mod_wsgi is for Python 3, not Python 2. However, there's one thing I haven't tried, that is compiling mod_wsgi myself from the instructions on the official website. If I recall correctly, it is supposed to handle both version of Python at the same time.
– GeoffreyFrogeye
Nov 24 '16 at 15:53




Sadly not, I have given up. Looks like Arch Linux package mod_wsgi is for Python 3, not Python 2. However, there's one thing I haven't tried, that is compiling mod_wsgi myself from the instructions on the official website. If I recall correctly, it is supposed to handle both version of Python at the same time.
– GeoffreyFrogeye
Nov 24 '16 at 15:53












Have you tried using the WSGIPythonHome directive? The documentation suggests that it's this directive that is used to tell Apache to use a certain Python executable. The python-path option to WSGIDaemonProcess is only for modifying the Python module search path.
– Psychonaut
Nov 4 '17 at 12:04




Have you tried using the WSGIPythonHome directive? The documentation suggests that it's this directive that is used to tell Apache to use a certain Python executable. The python-path option to WSGIDaemonProcess is only for modifying the Python module search path.
– Psychonaut
Nov 4 '17 at 12:04










1 Answer
1






active

oldest

votes

















up vote
0
down vote













I had the same Timeout when reading response headers from daemon process problem. Apache's main log file (not the one for that VirtualHost) showed this error:



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.


It turned out the home directory for ffsync didn't exist. Changing it to /opt/mozilla-firefox-sync-server/ resolved the problem for me. Maybe it helps you as well!






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f244724%2fmod-wsgi-with-apache-ignoring-python-path%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    I had the same Timeout when reading response headers from daemon process problem. Apache's main log file (not the one for that VirtualHost) showed this error:



    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.


    It turned out the home directory for ffsync didn't exist. Changing it to /opt/mozilla-firefox-sync-server/ resolved the problem for me. Maybe it helps you as well!






    share|improve this answer

























      up vote
      0
      down vote













      I had the same Timeout when reading response headers from daemon process problem. Apache's main log file (not the one for that VirtualHost) showed this error:



      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.


      It turned out the home directory for ffsync didn't exist. Changing it to /opt/mozilla-firefox-sync-server/ resolved the problem for me. Maybe it helps you as well!






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        I had the same Timeout when reading response headers from daemon process problem. Apache's main log file (not the one for that VirtualHost) showed this error:



        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.


        It turned out the home directory for ffsync didn't exist. Changing it to /opt/mozilla-firefox-sync-server/ resolved the problem for me. Maybe it helps you as well!






        share|improve this answer












        I had the same Timeout when reading response headers from daemon process problem. Apache's main log file (not the one for that VirtualHost) showed this error:



        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.


        It turned out the home directory for ffsync didn't exist. Changing it to /opt/mozilla-firefox-sync-server/ resolved the problem for me. Maybe it helps you as well!







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 7 at 20:47









        Torsten Grote

        1




        1






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f244724%2fmod-wsgi-with-apache-ignoring-python-path%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Morgemoulin

            Scott Moir

            Souastre