Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 90d9361

Browse files
committedMar 11, 2025··
fix start if the fancyindex module is not loaded/also include stdout in error output of execFile
Signed-off-by: Zoey <zoey@z0ey.de>
1 parent c74cd40 commit 90d9361

File tree

7 files changed

+35
-43
lines changed

7 files changed

+35
-43
lines changed
 

‎README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ a) Custom Nginx Configuration (advanced tab), which looks the following for file
159159
location / {
160160
include conf.d/include/always.conf;
161161
alias /var/www/<your-html-site-folder-name>/;
162-
fancyindex off; # alternative to nginxs "index" option (looks better and has more options), please load the module first in the compsoe.yaml
163-
}
162+
fancyindex off; # alternative to nginxs "index" option (looks better and has more options), please load the module first in the compose.yaml
164163
```
165164
b) Custom Nginx Configuration (advanced tab), which looks the following for file server and **php**:
166165
- Note: the slash at the end of the file path is important
@@ -171,8 +170,7 @@ b) Custom Nginx Configuration (advanced tab), which looks the following for file
171170
location / {
172171
include conf.d/include/always.conf;
173172
alias /var/www/<your-html-site-folder-name>/;
174-
fancyindex off; # alternative to nginxs "index" option (looks better and has more options), please load the module first in the compsoe.yaml
175-
173+
fancyindex off; # alternative to nginxs "index" option (looks better and has more options), please load the module first in the compose.yaml
176174
location ~ [^/]\.php(/|$) {
177175
fastcgi_pass php82;
178176
fastcgi_split_path_info ^(.+?\.php)(/.*)$;

‎backend/lib/utils.js

+6-11
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,17 @@ module.exports = {
2626
* @param {String} cmd
2727
* @param {Array} args
2828
*/
29-
execFile: async function (cmd, args, options = {}) {
29+
execFile: function (cmd, args) {
3030
logger.debug('CMD: ' + cmd + ' ' + (args ? args.join(' ') : ''));
31-
const { stdout, stderr } = await new Promise((resolve, reject) => {
32-
const child = execFile(cmd, args, options, (isError, stdout, stderr) => {
33-
if (isError) {
34-
reject(new error.CommandError(stderr, isError));
31+
return new Promise((resolve, reject) => {
32+
execFile(cmd, args, (err, stdout, stderr) => {
33+
if (err) {
34+
reject(new error.CommandError((stdout + stderr).trim(), err));
3535
} else {
36-
resolve({ stdout, stderr });
36+
resolve((stdout + stderr).trim());
3737
}
3838
});
39-
40-
child.on('error', (e) => {
41-
reject(new error.CommandError(stderr, 1, e));
42-
});
4339
});
44-
return stdout;
4540
},
4641

4742
/**

‎rootfs/usr/local/bin/aio.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
if [ "$NC_AIO" = "true" ] && [ ! -f /data/aio.lock ]; then
44
while [ "$(healthcheck.sh)" != "OK" ]; do sleep 10s; done
55
# shellcheck disable=SC2016
6-
curl -POST http://127.0.0.1:"$NIBEP"/nginx/proxy-hosts -sH 'Content-Type: application/json' -d '{"domain_names":["'"$NC_DOMAIN"'"],"forward_scheme":"http","forward_host":"127.0.0.1","forward_port":11000,"access_list_id":"0","certificate_id":"new","meta":{"letsencrypt_email":"","letsencrypt_agree":true,"dns_challenge":false},"advanced_config":"","locations":[{"path":"/","advanced_config":"proxy_set_header Accept-Encoding $http_accept_encoding;","forward_scheme":"http","forward_host":"127.0.0.1","forward_port":11000}],"block_exploits":false,"caching_enabled":false,"allow_websocket_upgrade":true,"http2_support":true,"hsts_enabled":true,"hsts_subdomains":true,"ssl_forced":true}' -H "Authorization: Bearer $(curl -POST http://127.0.0.1:"$NIBEP"/tokens -sH 'Content-Type: application/json' -d '{"identity":"'"$INITIAL_ADMIN_EMAIL"'"],"secret":"'"$INITIAL_ADMIN_PASSWORD"'"]}' | jq -r .token)"
6+
if ! curl -POST http://127.0.0.1:"$NIBEP"/nginx/proxy-hosts -sSH 'Content-Type: application/json' -d '{"domain_names":["'"$NC_DOMAIN"'"],"forward_scheme":"http","forward_host":"127.0.0.1","forward_port":11000,"allow_websocket_upgrade":true,"access_list_id":"0","certificate_id":"new","ssl_forced":true,"http2_support":true,"hsts_enabled":true,"hsts_subdomains":true,"meta":{"letsencrypt_email":"","letsencrypt_agree":true,"dns_challenge":false},"advanced_config":"","locations":[{"path":"/","advanced_config":"proxy_set_header Accept-Encoding $http_accept_encoding;","forward_scheme":"http","forward_host":"127.0.0.1","forward_port":11000}],"block_exploits":false,"caching_enabled":false}' -H "Authorization: Bearer $(curl -POST http://127.0.0.1:"$NIBEP"/tokens -sSH 'Content-Type: application/json' -d '{"identity":"'"$INITIAL_ADMIN_EMAIL"'","secret":"'"$INITIAL_ADMIN_PASSWORD"'"}' | jq -r .token)" | jq; then
7+
echo "The default config for AIO should now be created."
8+
else
9+
echo "There was an error creating the TLS certificate for AIO. Please try to create the cert yourself in the NPMplus UI and update the AIO proxy host to use this cert, see the NPMplus config in the AIO reverse proxy guide as an example for the TLS tab."
10+
fi
711
touch /data/aio.lock
8-
echo "The default config for AIO should now be created. Please check the log for any errors and try to resolve them, then delete the aio.lock file and retry."
912
fi

‎rootfs/usr/local/bin/launch.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Group ID: $(id -g)
1010
-------------------------------------
1111
"
1212

13-
if [ -z "$(find /data/tls/certbot/accounts/"$(echo "$ACME_SERVER" | sed "s|^https\?://\([^/]\+\).*$|\1|g")" -type f)" ]; then
13+
if [ -z "$(find /data/tls/certbot/accounts/"$(echo "$ACME_SERVER" | sed "s|^https\?://\([^/]\+\).*$|\1|g")" -type f 2> /dev/null)" ]; then
1414
if [ "$(echo "$ACME_SERVER" | sed "s|^https\?://\([^/]\+\).*$|\1|g")" = "acme.zerossl.com" ] && [ -z "$ACME_EAB_KID" ] && [ -z "$ACME_EAB_HMAC_KEY" ]; then
1515
if [ -z "$ACME_EMAIL" ]; then
1616
echo "ACME_EMAIL is required to use zerossl. Either set it or use a different acme server like letsencrypt (ACME_SERVER: https://acme-v02.api.letsencrypt.org/directory)"

‎rootfs/usr/local/bin/start.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ if [ -n "$NC_AIO" ] && ! echo "$NC_AIO" | grep -q "^true$\|^false$"; then
4444
sleep inf
4545
fi
4646
if [ "$NC_AIO" = "true" ]; then
47-
if [ -z "$NC_DOMAIN" ]; then
48-
echo "NC_DOMAIN is required in AIO mode."
47+
if [ -z "$NC_DOMAIN" ] || ! echo "$NC_DOMAIN" | grep -q "\."; then
48+
echo "NC_DOMAIN is unset (but required in AIO mode) or invalid, it needs to contain a dot."
4949
sleep inf
5050
fi
5151
export DISABLE_HTTP="${DISABLE_HTTP:-true}"
@@ -144,12 +144,12 @@ if [ -z "$TZ" ] || ! echo "$TZ" | grep -q "^[A-Za-z0-9_+-]\+/[A-Za-z0-9_+-]\+$";
144144
fi
145145

146146

147-
if ! echo "$ACME_SERVER" | grep -q "^https\?://.\+$"; then
147+
if ! echo "$ACME_SERVER" | grep -q "^https\?://"; then
148148
echo "ACME_SERVER needs to start with http:// or https://"
149149
sleep inf
150150
fi
151151

152-
if [ -n "$ACME_EMAIL" ] && ! echo "$ACME_EMAIL" | grep -q "^.*@.*$"; then
152+
if [ -n "$ACME_EMAIL" ] && ! echo "$ACME_EMAIL" | grep -q "@"; then
153153
echo "ACME_EMAIL needs to contains @."
154154
sleep inf
155155
fi
@@ -956,6 +956,8 @@ if [ "$NGINX_LOAD_OPENTELEMETRY_MODULE" = "true" ]; then
956956
fi
957957
if [ "$NGINX_LOAD_FANCYINDEX_MODULE" = "true" ]; then
958958
sed -i "s|#\(load_module.\+ngx_http_fancyindex_module.so;\)|\1|g" /usr/local/nginx/conf/nginx.conf
959+
sed -i "s|#fancyindex|fancyindex|g" /usr/local/nginx/conf/nginx.conf
960+
sed -i "s|#fancyindex|fancyindex|g" /usr/local/nginx/conf/conf.d/include/always.conf
959961
fi
960962
if [ "$NGINX_LOAD_GEOIP2_MODULE" = "true" ]; then
961963
sed -i "s|#\(load_module.\+geoip2_module.so;\)|\1|g" /usr/local/nginx/conf/nginx.conf
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
location /.well-known/acme-challenge/ {
22
root /tmp/acme-challenge;
3-
fancyindex off;
43
index off;
4+
#fancyindex off;
55
auth_basic off;
66
allow all;
77
}
88

9-
location /fancyindex/ {
10-
alias /html/fancyindex/;
11-
fancyindex off;
12-
index off;
13-
}
14-
159
location ~ /\.ht {
1610
deny all;
1711
}

‎rootfs/usr/local/nginx/conf/nginx.conf

+14-14
Original file line numberDiff line numberDiff line change
@@ -132,20 +132,20 @@ http {
132132
}
133133

134134
# Fancy Index
135-
fancyindex off;
136-
fancyindex_localtime on;
137-
fancyindex_show_path on;
138-
fancyindex_exact_size off;
139-
fancyindex_show_dotfiles off;
140-
fancyindex_hide_symlinks off;
141-
fancyindex_case_sensitive on;
142-
fancyindex_default_sort name;
143-
fancyindex_hide_parent_dir off;
144-
fancyindex_directories_first on;
145-
fancyindex_time_format "%Y-%m-%d %T";
146-
fancyindex_ignore "fancyindex";
147-
fancyindex_header "/fancyindex/header.html";
148-
fancyindex_footer "/fancyindex/footer.html";
135+
index off;
136+
#fancyindex off;
137+
#fancyindex_localtime on;
138+
#fancyindex_show_path on;
139+
#fancyindex_exact_size off;
140+
#fancyindex_show_dotfiles off;
141+
#fancyindex_hide_symlinks off;
142+
#fancyindex_case_sensitive on;
143+
#fancyindex_default_sort name;
144+
#fancyindex_hide_parent_dir off;
145+
#fancyindex_directories_first on;
146+
#fancyindex_time_format "%Y-%m-%d %T";
147+
#fancyindex_header /html/fancyindex/header.html local;
148+
#fancyindex_footer /html/fancyindex/footer.html local;
149149

150150
# Real IP Determination
151151
real_ip_recursive on;

0 commit comments

Comments
 (0)
Please sign in to comment.