apache2 issues

March 12, 2024, 16:07

generalkenobi_2

I've got my directories autoindexed and working fine, but I cannot get jpgs or gifs to load. They all display 404.

generalkenobi_2


generalkenobi_2

now if i rename it with no extension

generalkenobi_2


generalkenobi_2


generalkenobi_2

it works fine.

generalkenobi_2

I have no idea what's causing this.

oops.se

Check the read rights on files and directory

oops.se

And check the log file /var/log/apache2

generalkenobi_2


generalkenobi_2

777

generalkenobi_2

/var/log/apache2/error.log has no related entries.

generalkenobi_2

there's lots of chatter.

generalkenobi_2

none about the 404 i'm being served

generalkenobi_2

log levels are set to debug, so i'd expect to see something

generalkenobi_2

what's odd is that all other file types work.

generalkenobi_2

well, all that i've tested

generalkenobi_2

I've not tested video, but images seem to be the only issue.

oops.se

root should never be owner to the files

generalkenobi_2

www-data

generalkenobi_2

?

oops.se

probably

oops.se

That is a common user www-data

generalkenobi_2

i'll change it, but i don't think it's the cause due to the differing behavior

oops.se

I agree

oops.se

And what did the log say?

generalkenobi_2

the log said nothing relating to the file

generalkenobi_2


oops.se

That is NOT the log, that is the log config

generalkenobi_2

well i know that

generalkenobi_2

I was showing you it was set to debug

oops.se

And change the loglevel as it is debug now

generalkenobi_2

change it to?

oops.se

warning, error or info

generalkenobi_2

i thought debug was the most verbose

oops.se

yes, and you don't need that

oops.se

And restart apache2

generalkenobi_2

already did

oops.se

And then use the browser på a image

oops.se

and then check the log file

oops.se

and post the output

oops.se

you should see fetch/get of the image and the result of that operation

generalkenobi_2


generalkenobi_2

I would expect to see a GET

generalkenobi_2

but i'm not

generalkenobi_2

i set it to info btw

oops.se

I cant see anything, my visual impairment don't work well with pictures of text

generalkenobi_2

i'll copy paste

oops.se

Yes please and use formatting

oops.se

Nice!

generalkenobi_2

i tried for /icons/a.gif

oops.se

Thatr has nothing about a http session from a client

generalkenobi_2

this is the error.log

generalkenobi_2

should there be additional logging?

oops.se

You are correct

generalkenobi_2

i'm so smart.

generalkenobi_2

that's sarcasm

generalkenobi_2

anyway, yeah, there's another log. access.log

oops.se

There you have GET /icons/ubuntu-logo

generalkenobi_2

but it's like it's not even seeing my requests with .gif .png or .jpg

generalkenobi_2

yeah

generalkenobi_2

but that's not my issue

generalkenobi_2

it used to be ubuntu-log.gif

generalkenobi_2

i changed it to remove the extension

oops.se

I know

generalkenobi_2

and tested

generalkenobi_2

i ran a 'cat * | grep gif ' against the mods-available, it had several hits against the autoindex configuration, and they were all for icons.

generalkenobi_2

there was a reference in aliases, which i disabled because i thought maybe it was interfering.

generalkenobi_2

issues persist

generalkenobi_2

originally when the files were in /usr/share/www/icons the results were the same

generalkenobi_2

pita.

oops.se

I just installed apache2

generalkenobi_2

can you load images?

oops.se

Yes. I added Alias /icons/ /var/www/html/icons/ /etc/apache2/sites-available/000-default.conf

oops.se

Example
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        Alias /icons/ /var/www/html/icons/

oops.se

And when I comment out the "Alias" it doesn't get the png file, error 404

oops.se

I'm a bit rusty on apache was a couple years since I did "Hands on"

generalkenobi_2

ok, so, to confirm you can do mysite.com/icons/a.gif and you do not get a 404?

generalkenobi_2

however.

oops.se

I use IP not DNS so I can't do that

generalkenobi_2

go there

generalkenobi_2

do you see a.gif?

generalkenobi_2

indexed

oops.se

Yes and I get a 404

generalkenobi_2

that's not even in an /icons/ directory

generalkenobi_2

it's in /public/

generalkenobi_2

adding that alias should fix it?

oops.se

Strange the mp3 could I access

generalkenobi_2

it all works except images

oops.se

Alias works for subdirectories to the DocumentRoot

oops.se

So I suspect the indexing

generalkenobi_2

as in the autoindexing feature is breaking it?

oops.se

perhaps

generalkenobi_2

in my shoes how would you approach this? stackexchange? or github problem report

generalkenobi_2

hmmm

generalkenobi_2

I could just disable the indexing.

oops.se

Since I have no knowledge about autoindexing idk

generalkenobi_2

hold on, let me try that

oops.se

Is that a mod in Apache2?

generalkenobi_2

yeah, there's a config for it, but i was just going to comment out the options line for that directory

generalkenobi_2

same result

generalkenobi_2

after reload

oops.se

Stack exchange has probably someone that has knowledge on this topic

generalkenobi_2

do you use other methods to host via http?

generalkenobi_2

rather than apache

oops.se

I have used nginx in the later years.

oops.se

But I mostly make jump pages and status pages with data connections

generalkenobi_2

I use nginx to reach this server.

generalkenobi_2

not as a web host however

generalkenobi_2

reverse proxy

oops.se

Well that is the nice thing with open source, there are many roads to Rome

generalkenobi_2

actually, on that note.

generalkenobi_2

is there anything in nginx that would snag a forward and not pass it because it contained .jpg or .gif?

generalkenobi_2

because I did note that apache didn't even acknowledge it got those requests

generalkenobi_2

omg it isn't

generalkenobi_2

that's why

generalkenobi_2

it's not an apache issue

generalkenobi_2

it's an nginx issue

generalkenobi_2

Not Found The requested URL was not found on this server. Apache/2.4.57 (Debian) Server at generalkenobi2.duckdns.org Port 81

generalkenobi_2

if i try to access /public/b

generalkenobi_2

if i try to access /public/a.gif (which is actually there)

generalkenobi_2

404 not found

generalkenobi_2


generalkenobi_2


generalkenobi_2

number 2 being b.gif

generalkenobi_2

totally different response

generalkenobi_2

lol so you know nginx?

oops.se

A bit

generalkenobi_2

I think i found the issue. just trying to find where it is.

generalkenobi_2

in the config

generalkenobi_2

[root@docker-641bd6674e6e:/etc/nginx/conf.d/include]# cat assets.conf location ~ ^.\.(css|js|jpe?g|gif|png|webp|woff|eot|ttf|svg|ico|css\.map|js\.map)$ { if_modified_since off; # use the public cache proxy_cache public-cache; proxy_cache_key $host$request_uri; # ignore these headers for media proxy_ignore_headers Set-Cookie Cache-Control Expires X-Accel-Expires; # cache 200s and also 404s (not ideal but there are a few 404 images for some reason) proxy_cache_valid any 30m; proxy_cache_valid 404 1m; # strip this header to avoid If-Modified-Since requests proxy_hide_header Last-Modified; proxy_hide_header Cache-Control; proxy_hide_header Vary; proxy_cache_bypass 0; proxy_no_cache 0; proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504 http_404; proxy_connect_timeout 5s; proxy_read_timeout 45s; expires @30m; access_log off; include conf.d/include/proxy.conf;

generalkenobi_2

bet this is it.

generalkenobi_2

i fixed it.

generalkenobi_2

had to remove those extensions from this assets config in the nginx proxy server

generalkenobi_2

Thanks for making my brain think

generalkenobi_2

and thank you for working with me.

generalkenobi_2

Twice now.

generalkenobi_2

MVP award.

oops.se

Glad you made it