I have an issue with chrome.
I am getting below error when accessing device on a browser. using http://MyDeviceIP
We encountered an error when reaching this balena.io device:
UUID 8396300de774bdd5f50d51ea3ff3fe48
tunneling socket could not be established: 500
One possible reason is because nothing is listening on port 80 on the device.
NOTE: I have exposed port 80 in a code.
Here is a link to the device summary:
https://dashboard.balena-cloud.com/devices/8396300de774bdd5f50d51ea3ff3fe48/summary
I’ve activated support access.
Hello! Please make sure you set the ports
setting for the desired container on your docker-compose.yml
file. See here for an example: Communicate outside the container - Balena Documentation
Hi,
This is still not helping,
I am getting below errors in the log
main 52.4.252.97 - - [23/Jun/2022:15:57:41 +0000] "GET / HTTP/1.1" 404 548 "https://dashboard.balena-cloud.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36" "-"
Link to device summary: balena dashboard
Hello, I see in your latest release that you are using a single service. Since single service fleets always use host networking, port 80 should be exposed. By default, the Nginx HTTP server listens for inbound connections and connects to port 80, so unless you’ve changed that default, you should be set. The log snippet you posted is actually from NGINX’s access log, showing that a client (such as a web browser) has connected to the device and tried to pull the default page (“\
”) from the server, but it was not found. Please make sure you have a default file (typically named index.html
) in the NGINX document root. That location is usually defined in your NGINX conf file and often defaulted to /usr/share/nginx/html . Your device is offline now, so I’m not able to confirm.
Also, you may want to check your power supply, as the device is showing an “undervolt” warning. It should be at least 5V, 2.5A. Anything less can cause erratic and difficult-to-diagnose behavior.
Hi Alan,
Thank you for your reply, I have kept my index.html file at the /var/www/html i have also mentioned the path in my conf file.
I have also now changed my power source and fixed the under power issue, However I am still facing this issue.
Can you please guide me through?
hello,
It looks like your nginx configuration is very wrong : /etc/nginx/conf.d/default.conf
# Everything is a 404
location / {
return 404;
}
You need something in the like of :
server {
listen 80 default_server;
root /var/www/html;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}
Hi Edwin,
Even this solution is not helping me, I am still getting the same error.
Can someone please guide me on this?
I am not able to find a breakthrough.
I can’t access the device, so I can’t check your configuration anymore.
From what I remember :
- networking works fine as the server is responding with a 404
- nginx was configured to always reply with a 404 (which you fixed by changing the configuration with my previous suggestion)
Do you have an index.html
file in /var/www/html
?
If so what’s the permission on that file ?
Also what are you trying to achieve ? Just serving a static page ?
Hi,
Sorry I have granted support access to my device again,
I am having index.html file at /var/ww/html and its have 777 permission.
Can you please guide me thorugh?
conf file
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html;
location / {
try_files $uri $uri/ =404;
}
location = /events.json {
proxy_set_header Authorization "APIKEY ${THREERINGS_APIKEY}";
proxy_pass https://xxx
}
location = /stats/export_rotas.json {
proxy_set_header Authorization "APIKEY ${THREERINGS_APIKEY}";
proxy_pass https://xxx
}
location = /wiki/branchcommsscreens/all_pages.json {
proxy_set_header Authorization "APIKEY ${THREERINGS_APIKEY}";
proxy_pass https://xxx
}
location /intranet/status/ {
proxy_pass https://xxx
}
location /static/ {
proxy_pass https://xxx
}
}
Docker file
Docker file
FROM balenalib/%%BALENA_MACHINE_NAME%%-alpine:3.12-run
RUN set -x \
&& apk add --no-cache gettext nginx \
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
&& mkdir /docker-entrypoint.d \
&& mkdir -p /etc/nginx/templates \
&& mkdir -p /run/nginx
COPY docker-entrypoint.sh /
COPY 20-envsubst-on-templates.sh /docker-entrypoint.d
COPY default.conf.template /etc/nginx/templates
COPY html /var/www/html
ENTRYPOINT ["bash","/docker-entrypoint.sh"]
EXPOSE 80
STOPSIGNAL SIGTERM
CMD ["nginx", "-g", "daemon off;"]
docker-entrypoint file
#!/bin/sh
# vim:sw=4:ts=4:et
set -e
if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
exec 3>&1
else
exec 3>/dev/null
fi
if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
echo >&3 "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration"
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
find "/docker-entrypoint.d/" -follow -type f -print | sort -n | while read -r f; do
case "$f" in
*.sh)
if [ -x "$f" ]; then
echo >&3 "$0: Launching $f";
"$f"
else
# warn on shell scripts without exec bit
echo >&3 "$0: Ignoring $f, not executable";
fi
;;
*) echo >&3 "$0: Ignoring $f";;
esac
done
echo >&3 "$0: Configuration complete; ready for start up"
else
echo >&3 "$0: No files found in /docker-entrypoint.d/, skipping configuration"
fi
fi
exec "$@"
Hi,
I am trying to open my index.html on the TV
Hello I just SSHed into your nginx container and the config file in there is still:
bash-5.0# cat default.conf
# This is a default site configuration which will simply return 404, preventing
# chance access to any other virtualhost.
server {
listen 80 default_server;
listen [::]:80 default_server;
# Everything is a 404
location / {
return 404;
}
# You may need this to prevent return 404 recursion.
location = /404.html {
internal;
}
}
I see that the file you uploaded is in the /etc/nginx/templates
folder but the nginx.config file is not using it. If you just want to use this file as a configuration, you may upload it to /etc/nginx/conf.d/default.config
.
Ops, the correct name is /etc/nginx/conf.d/default.conf
actually