apacheperluwsgidancerpsgi

Why Dancer app fails under uWSGI + Apache?


My Dancer app fails under uWSGI (2.0.7) + Apache (2.4.10) combination while it runs freely in other environments ( uWSGI + nginx, Starman + Apache, Dancer own dev-server). I don't find in logs any meaningful information. So I made simple test app like

$ dancer -a tset

Then copied default production.yml into uwsgi.yml, linked bin/app.pl into bin/app.psgi created tset.ini like this:

[uwsgi]                                                                                                                                                                             
plugins   = psgi                                                                                                                                                                    
socket    = 127.0.0.1:3033                                                                                                                                                          
uid       = www                                                                                                                                                                     
gid       = www-data                                                                                                                                                                
chdir     = /home/www/apps/tset/bin/                                                                                                                                                
psgi      = app.psgi                                                                                                                                                                
processes = 1                                                                                                                                                                       
master    = true  

Made this ini available for uWsgi in /etc/uwsgi/apps-available, linked it into /etc/uwsgi/apps-enabled.

Restarted uwsgi service.

Then for Apache (2.4.10) module mod-proxy-uwsgi added few lines into my virtualhost conf:

ProxyPass /adm/y uwsgi://127.0.0.1:3033/

This seems most fragile point, because I feel like I need to set uWSGIModifier1 5 here but did not figured out where and how?

Restarted Apache and got "Internal Server Error". In uwsgi log I see just:

Tue Jan 19 02:10:36 2016 - spawned uWSGI worker 1 (pid: 21712, cores: 1)
Tue Jan 19 02:10:56 2016 - -- unavailable modifier requested: 0 --
Tue Jan 19 02:24:44 2016 - -- unavailable modifier requested: 0 --
Tue Jan 19 02:27:14 2016 - -- unavailable modifier requested: 0 --
Tue Jan 19 02:27:17 2016 - -- unavailable modifier requested: 0 --

What is this "unavailable modifier requested"?

In apache error.log is no entries, in access.log are entries, but no other information than status 500.

Such behavior is reproducible with steps above, so I hope you figure out, what is wrong in this combination?


Solution

  • I feel like I need to set uWSGIModifier1 5 here but did not figured out where and how?

    Yes, you're right. You should set modifier1 to 5, but uwsgi docs says about mod_proxy_uwsgi:

    Currently the module lacks the ability to set modifiers, though this will be fixed soon.

    That means, you can't pass modifier to uWSGI instance using this method (uWSGI will use modifier 0 if not supplied)

    To fix that issue, you can move to mod_uwsgi or change modifier on which psgi is loaded, using:

    plugins   = 0:psgi
    

    instead of

    plugins   = psgi