Problem to specify WSGIDaemonProcess in the site options with Let's encrypt enabled

Discussion in 'Installation/Configuration' started by Jürgen Depicker, Jun 4, 2020.

  1. Jürgen Depicker

    Jürgen Depicker New Member HowtoForge Supporter

    Hello,
    A python site running with mod_wsgi on my IspConfig server (latest version; ubuntu 18.04 LTS) required the locale to be utf-8 (the git library used by the site failed when a git branch name had a unicode character in it). By default www-data gives POSIX as locale:

    (root) runuser -s /bin/bash -l www-data -c "locale"
    LANG=
    LANGUAGE=
    LC_CTYPE="POSIX"
    LC_NUMERIC="POSIX"
    LC_TIME="POSIX"
    LC_COLLATE="POSIX"
    LC_MONETARY="POSIX"
    LC_MESSAGES="POSIX"
    LC_PAPER="POSIX"
    LC_NAME="POSIX"
    LC_ADDRESS="POSIX"
    LC_TELEPHONE="POSIX"
    LC_MEASUREMENT="POSIX"
    LC_IDENTIFICATION="POSIX"
    LC_ALL=

    On http://blog.dscpl.com.au/2014/09/setting-lang-and-lcall-when-using.html is explained that this can be easily solved with a statement like:
    WSGIDaemonProcess my-django-site lang='en_US.UTF-8' locale='en_US.UTF-8'

    IspConfig doesn't like it, and after some searching it turns out it's because the directive WSGIDaemonProcess requires a (unique) site name and IspConfig is duplicating the lines in the VirtualHost 80 and 443 sections. So apache2 refuses to start and IspConfig rolls back the site config changes.
    I needed to manually edit the site's vhost file to make the site names unique.

    Probably there's a better solution to this. Anyone an idea?
     
  2. Jürgen Depicker

    Jürgen Depicker New Member HowtoForge Supporter

    No ideas yet it seems :). I still welcome them!
     
  3. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    can you not set in in the apache directives section in the website options tab?
    if just setting it as
    Code:
    WSGIDaemonProcess my-django-site-https lang='en_US.UTF-8' locale='en_US.UTF-8'
    
    and it still complains, maybe as:
    Code:
    <If "%{HTTPS} == 'on'">
        WSGIDaemonProcess my-django-site-https lang='en_US.UTF-8' locale='en_US.UTF-8'
    </If>
    <If "%{HTTPS} == 'off'">
        WSGIDaemonProcess my-django-site-http lang='en_US.UTF-8' locale='en_US.UTF-8'
    </If>
    
     
  4. Jürgen Depicker

    Jürgen Depicker New Member HowtoForge Supporter

    Thanks for suggesting, but it doesn't work. See also https://talk.plesk.com/threads/wsgidaemonprocess-errors-to-death-on-dual-stack-hosts.345708/ reporting a somewhat similar problem under plesk.

    Your first suggestion doesn't work since ISPConfig duplicates the options in both the :80 and :443 sections.

    If I manually add the
    <If "%{HTTPS} == 'on'">
    WSGIDaemonProcess my-django-site-https lang='en_US.UTF-8' locale='en_US.UTF-8'
    </If>​
    lines even to only the :443 section in the vhost config, apache2 complains:
    apache2ctl configtest
    ...
    WSGIDaemonProcess not allowed here
    Action 'configtest' failed.

    I couldn't find out why, but it seems apache doesn't allow defining WSGIDaemonProcess inside an "If"...
     
  5. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    perhaps you need to specify the WSGIProcessGroup as well?

    or if <If "%{HTTPS} == 'on'"> doesn't work, try <IfModule mod_ssl.c> instead? if you have a valid cert, and redirect all http requests to https, then maybe it doesn't matter that it never actually gets applied to anything in the http vhost settings.
     
  6. Steini86

    Steini86 Active Member

    Hallo Jürgen,
    If it is an option for you, you can do a global config for all (new) webs by creating a custom vhost master file.
    The solutions seems to be to have only the http part configured and let the https part reference it.
    https://stackoverflow.com/questions/4893432/ssl-on-apache2-with-wsgi

    [edit]
    How have you implemented wsgi? There are a few guides on how to use wsgi on ispc, have you followed one of them?
    https://www.howtoforge.com/community/threads/django.24109/#post-221433
    Looks like this should do it:
    https://gist.github.com/prochor666/a367a9ebd7cf67f04668#file-ispconfig-apache-options-conf
     

Share This Page