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

    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"

    On 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 Active Member

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

    Jürgen Depicker New Member HowtoForge Supporter

    Thanks for suggesting, but it doesn't work. See also 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'
    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 Active Member

    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.

    How have you implemented wsgi? There are a few guides on how to use wsgi on ispc, have you followed one of them?
    Looks like this should do it:

Share This Page