I am currently trying to host multiple apps using uWSGI and Nginx. When I just host this on the server without trying to mount it, the Dash app works fine, and I’ve been using it for a while now. However, it’s when I try to host multiple apps that things start going awry. I am mounting these on myurl/apps/, so I’ll have myurl/apps/app1, myurl/apps/app2, and so on. When I just create a basic Flask app as a dummy app, this works fine. However, for the Dash app, I get “Error loading layout”. In the Nginx error log I have:
2017/11/11 21:54:38 [error] 23768#23768: *3373 open() "/var/www/html/_dash-dependencies" failed (2: No such file or directory), client: <redacted>, server: <redacted>, request: "GET /_dash-dependencies HTTP/1.1", host: "<redacted>", referrer: "myurl/apps/app1/"
and a similar thing for _dash-layout.
I have an Nginx config file which looks like this:
server {
listen 80;
server_name <redacted ip> <redacted url>;
root /var/www/html;
location /apps/app1/ {
include uwsgi_params;
uwsgi_pass unix:/var/tmp/app1.sock;
uwsgi_param SCRIPT_NAME /apps/app1/;
}
location /apps/app2/ {
include uwsgi_params;
uwsgi_pass unix:/var/tmp/app2.sock;
uwsgi_param SCRIPT_NAME /apps/app2/;
}
# and then a bunch of SSL stuff here...
}
app1 here is my Dash app and app2 is the Flask app. As noted, the Flask app runs fine, but the Dash app returns the aforementioned errors.
My app1.ini file looks like this:
[uwsgi]
base=/var/www/%n
chdir = /home/ubuntu/%n
module = wsgi:application
master = true
processes = 5
uid=ubuntu
gid=www-data
virtualenv=/home/ubuntu/%n/venv
socket = /var/tmp/%n.sock
chmod-socket = 666
vacuum = true
mount = /apps/%n=wsgi:application
manage-script-name = true
die-on-term = true
I use the same thing for all apps. Any idea what’s going on here? I assume it has something to do with Nginx looking in the wrong place for _dash-layout, etc., but I’m not sure why. Supposedly, adding “uwsgi_param SCRIPT_NAME /apps/app2/;” to the Nginx config file should take care of that (I’ve also tried adding “uwsgi_modifier1 30;” which doesn’t resolve the issue). Just to reiterate, my Dash app works fine when I just run it on the server without trying to do any of this mounting business, so it’s presumably something to do with it looking in the wrong place for the layout. I’ve googled this pretty exhaustively and I’m running out of things to try so thought I’d ask the community for help.
Edits: Clarification.