Website not working correctly or at all

Hello sir/madam,

I’ve gotten complaints from customers that our website doesn’t work. We recently switched from apache to nginx.

If the website works, some images are not even loaded up, just being broken.

We are running nginx over docker, so things are bit new to me. The other websites that run on the same image work fine.

the website is ottocar dot fi

Edit:
Noticed in the network log that it doesn’t find all the images, the error 404 appears image

You’re 100% sure the images exist and you have permissions set for them correctly?

The images are there and the filepaths for the images exist. I can open the website on the server to see that all the images work, and I can open the website on my computer to see that the website works, some of the images do not load. But also opening it on some phones the website does not load, dns probe error on chrome, But on my phone it works, edge browser, but also some images don’t load.

May or may not be related to IPv6. Depending on the provider and/or specific setup on the phone, they might not want to connect via IPv4:

[tarulia@localhost ~]$ ping ottocar.fi -4 -c 1
PING ottocar.fi (31.217.196.214) 56(84) bytes of data.
64 bytes from hotelli05.domainhotelli.fi (31.217.196.214): icmp_seq=1 ttl=55 time=47.7 ms

--- ottocar.fi ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 47.665/47.665/47.665/0.000 ms
[tarulia@localhost ~]$ ping ottocar.fi -6 -c 1
ping: ottocar.fi: Name or service not known

But the question was also whether your webserver-user has access to those files, i.e. of the permissions are set correctly.

It might be that the “working” images are only giving a false positive and only appear to be working even though they are not. I’ve had that happen before when the URL is still in some cache server somewhere and you get it delivered.

Best option: Look into the server logs, if it’s returning a 404 it should also be logging why it returned it and why it couldn’t find/access the file.

It appears partially working for me. Looks as if it is all there but the images for the specific vehicles, only two of those show up the Scenic and Saab 96

If it helps any when using the ottocar . fi URL it redirects and gives the 4byssal ddns as the URL.

It is because I’m using cname for abyss.fi and I haven’t come to any idea of how I should do this.

On the client side logs:
image
image

Server side:

1 Like

But the file is there:
image

Can you elaborate?

Whatever user the webserver process is running under (for instance, on Linux, Apache runs as www-data) needs to have access to those image files.

If you were running Apache, and uploaded the files and gave Apache access to them (either knowingly, or by default), and Apache ran as www-data, but now you switched to Nginx, and Nginx runs as (I have no idea) nginx-server, then nginx-server can’t access www-data’s files, even if you point it there.

You need to make sure nginx-server (or whatever user is running nginx) has permission to access the files.

Run top and see what user is running the nginx server? And then check permissions on the ottocar directory and see if that user has the right permissions, recursively.

2 Likes

you need to chown your img directory and img files to the user the web server is running as.

this is what I was asking earlier when I said are you 100% sure you have permissions set correctly.

2 Likes

this is a docker container so cli? I have no idea

?

I’m new to docker, and hate that this is very good option.

chown is a linux command to change ownership

Top should still show you what users things are running as. Here’s an example from my server, where just about every major process is dockerized:

image

Oh, I forgot to mention we are running windows 2019 on the server with docker on it.

Top doesn’t work in CLI but chown seems to, how do I run it
image

you should use

docker top CONTAINERNAME

You cant change the owner without knowing who to set the owner to

Docker on windows server is not a standard setup many would use. You’re going to be working with linux commands and linux permissions translated to a windows environment. Linux can work with ACLs but its usually simpler to not use them for this use case.

Something we can try as an alternative is to set /img/ to 644 permissions recursively.

https://www.guru99.com/file-permissions.html#2

you would do

chmod -R 644 /usr/share/nginx/html/ottocar/img

This should give everyone the ability to read anything below the img directory and the owner the ability to read + write


Docker is primarily geared towards linux and on windows it utilizes WSL. This comes with some caveats if you ever need to virtualize since WSL is now reliant on hyper-v. I wont tell you that you shouldnt use docker on windows but that you should strongly consider if what you’re doing makes sense.

Well we had this license and we were like, lets do it. I have no idea anymore what I’m doing on the server, it used to be simply xampp and few other things on windows 10 machine.

I did that command and restarted the container. Doesn’t seem to work

I would suggest you take some time to learn some linux fundamentals before standing up a webserver exposed to the internet… however I’m not your mother so you can do as you please.

whats the output of ls -la /usr/share/nginx/html/ottocar/img?

2 Likes

image

Well I’ve been using linux for a while but never got a fond of it , it just doesn’t feel good. Feel unpolished, we gotta take this to another thread or so.

whatever command you said didnt apply anything because your permissions are 755 with the owner set to root

however

you should be able to read those files from any user so long as the user can access the folder

can you show me the permissions on img? ls -la /usr/share/nginx/html/ottocar

image

The permissions, while probably not the best configuration, should allow the images to load. So the problem must lie somewhere else… I’m guessing in the way the images are referred in the html.