You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found a curious bug, couldn't find it on here or stackoverflow. It could be due to using replacement patterns to set the root or due to hosting from home folder (snap packages including Chromium had access issues in home folder including failing to save to ~/Downloads). I'm using nginx with per-domain tenants in a sibling folder without issues, so it doesn't look like it's nginx's issue. Sorry, it's a bit elaborate.
The error looks like this (nothing special here until you see the actual resolved paths below): ...age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /home/user/.WORK/app: An operating system error occurred while preparing to spawn an application process: Cannot lstat("/home/user/.WORK/app/index.js"): No such file or directory (errno=2)
Where the path was actually resolved by nginx as /home/user/.WORK/app/newapp/index.js so /newapp/ got skipped, I blamed the empty replacement $1 at first, but no, it's just skipped.
The nginx settings look like the following:
server {
listen 80;
server_name ~^([^.]*)\.app$;
# $apps path hosts all kinds of apps under it
# resolving to site name in sub folder
set $apps "/home/user/.WORK/app";
set $app_root "$apps/$1";
root "$app_root";
passenger_enabled on;
passenger_app_type node;
passenger_startup_file index.js;
}
The expected results are: http://newapp.app
now root directive above should resolve to /home/user/.WORK/app/newapp/index.js
this doesn't work, resolves to /home/user/.WORK/app/newapp correctly,
but understood as /home/user/.WORK/app/index.js set $apps "/home/user/.WORK/app/$1";
but adding it the second time works??? set $app_root "$apps/$1";
then, it was evident that whatever folder I add, the last item was always ignored (even if it exists)
this is equivalent to the last one and produces /home/user/.WORK/app/newapp/newapp set $apps "/home/user/.WORK/app"; set $app_root "$apps/$1/$1";
but the issue was that the error would always say cannot stat /home/user/.WORK/app/newapp/abc/index.js
ignoring the last /def/ part once again (no matter if end slashes are used or not) set $app_root "$apps/$1/abc/def/";
so simply adding garbage "fixes" the parser set $app_root "$apps/$1/sdgfrkjth/";
Once again, the paths are replaced correctly
so $apps/$1/b8huj5h6/
is replaced to become /home/user/.WORK/app/newapp/b8huj5h6/ correctly,
but the parser thinks it need to use /home/user/.WORK/app/newapp/index.js ignoring the last part
Using:
Passenger 6.0.4 as nginx-module on Ubuntu 18 (mint)
via Phusion APT repo
it's a basic Node.js app
The text was updated successfully, but these errors were encountered:
I found a curious bug, couldn't find it on here or stackoverflow. It could be due to using replacement patterns to set the root or due to hosting from home folder (snap packages including Chromium had access issues in home folder including failing to save to ~/Downloads). I'm using nginx with per-domain tenants in a sibling folder without issues, so it doesn't look like it's nginx's issue. Sorry, it's a bit elaborate.
The error looks like this (nothing special here until you see the actual resolved paths below):
...age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /home/user/.WORK/app: An operating system error occurred while preparing to spawn an application process: Cannot lstat("/home/user/.WORK/app/index.js"): No such file or directory (errno=2)
Where the path was actually resolved by nginx as
/home/user/.WORK/app/newapp/index.js
so/newapp/
got skipped, I blamed the empty replacement $1 at first, but no, it's just skipped.The nginx settings look like the following:
The expected results are:
http://newapp.app
now
root
directive above should resolve to/home/user/.WORK/app/newapp/index.js
this doesn't work, resolves to
/home/user/.WORK/app/newapp
correctly,but understood as
/home/user/.WORK/app/index.js
set $apps "/home/user/.WORK/app/$1";
but adding it the second time works???
set $app_root "$apps/$1";
then, it was evident that whatever folder I add, the last item was always ignored (even if it exists)
this is equivalent to the last one and produces
/home/user/.WORK/app/newapp/newapp
set $apps "/home/user/.WORK/app";
set $app_root "$apps/$1/$1";
but the issue was that the error would always say
cannot stat /home/user/.WORK/app/newapp/abc/index.js
ignoring the last
/def/
part once again (no matter if end slashes are used or not)set $app_root "$apps/$1/abc/def/";
so simply adding garbage "fixes" the parser
set $app_root "$apps/$1/sdgfrkjth/";
Once again, the paths are replaced correctly
so
$apps/$1/b8huj5h6/
is replaced to become
/home/user/.WORK/app/newapp/b8huj5h6/
correctly,but the parser thinks it need to use
/home/user/.WORK/app/newapp/index.js
ignoring the last partUsing:
Passenger 6.0.4 as nginx-module on Ubuntu 18 (mint)
via Phusion APT repo
it's a basic Node.js app
The text was updated successfully, but these errors were encountered: