Page 1 of 1

NGINX Container returns me Forbidden 403

Posted: Sun Jul 16, 2023 6:48 pm
by deanMK
Hi Mikrotik

I use hAP AX3 with container package installed and working. Today installed NGINX container, and all works fine, except that on every file i got "Forbidden 403" error , no matter on permission i set on file. nginx container is working properly:
[admin@MikroTik] /container> pr
 0 name="9448b877-5ea9-4b9e-8499-2f0ab03185a4" tag="library/nginx:latest" os="linux" arch="arm64" interface=veth1 root-dir=usb1/nginx mounts=html dns="" status=running 
i have created "html" folder on my USB stick.

This is my Container configuration:
# 2023-07-16 17:43:46 by RouterOS 7.10.2
# software id = MGL0-4L4W
#
# model = C53UiG+5HPaxD2HPaxD
# serial number = XXXXXXXX
/container mounts
add dst=/usr/share/nginx/html name=html src=/usb1/html
/container
add interface=veth1 mounts=html root-dir=usb1/nginx
/container config
set registry-url=https://registry-1.docker.io tmpdir=usb1/pool
Everything seems to works, but i got Forbidden 403 on every file i upload to my usb stick. Anyone with tip how to solve this?

Files stuck on CHMOD 660 whatever i tryed to set to 755.

Image

Image

Re: NGINX Container returns me Forbidden 403

Posted: Mon Aug 28, 2023 7:57 am
by ConradPino
Read RouterOS Containers ยง Tips and tricks Look for:
  • Enable logging to get output from container:
  • It is possible to get to running container shell:

Use the container shell to view these files:
/var/log/nginx/access.log
/var/log/nginx/error.log

Re: NGINX Container returns me Forbidden 403

Posted: Fri Jan 05, 2024 5:47 am
by antosusan
Hi Mikrotik

I use hAP AX3 with container package installed and working. Today installed NGINX container, and all works fine, except that on every file i got "Forbidden 403" error , no matter on permission i set on file. nginx container is working properly:
[admin@MikroTik] /container> pr
 0 name="9448b877-5ea9-4b9e-8499-2f0ab03185a4" tag="library/nginx:latest" os="linux" arch="arm64" interface=veth1 root-dir=usb1/nginx mounts=html dns="" status=running 
i have created "html" folder on my USB stick.

This is my Container configuration:
# 2023-07-16 17:43:46 by RouterOS 7.10.2
# software id = MGL0-4L4W
#
# model = C53UiG+5HPaxD2HPaxD
# serial number = XXXXXXXX
/container mounts
add dst=/usr/share/nginx/html name=html src=/usb1/html
/container
add interface=veth1 mounts=html root-dir=usb1/nginx
/container config
set registry-url=https://registry-1.docker.io tmpdir=usb1/pool
Everything seems to works, but i got Forbidden 403 on every file i upload to my usb stick. Anyone with tip how to solve this?

Files stuck on CHMOD 660 whatever i tryed to set to 755.

Image

Image
i have this problem and i reinstall the container and problem is solved

Re: NGINX Container returns me Forbidden 403

Posted: Fri Jan 05, 2024 10:11 am
by patrikg
How do you format the usb memory stick ? ext2/3/4,fat,fat32, or ntfs....

And i think you can execute the id command to get what username and usernumber trying to read write files ? From the webserver perspective.

And what i can see in your picture (at the end of the line) the user root owns the files.
May be the nginx server uses some another user, to read files.
Maybe as a workaround you can set read and write permission to the Public Permissions.
But I suggest you to investigate what user being used then using nginx container.

And what are the nginx config says where is the root ??