Hi, I use Gitea on OpenBSD, with nginx as proxy for gitea.
(see: git.huc.fr.eu.org)
My nginx config:
server_name git.huc.fr.eu.org;
access_log logs/git.huc.fr.eu.org/access.log main;
error_log logs/huc.fr.eu.org/errors.log;
# root /; not need!
if ($host !~ ^(git.huc.fr.eu.org|www.git.huc.fr.eu.org)$ ) { return 444; }
add_header Access-Control-Allow-Origin "git.huc.fr.eu.org" always;
location /.well-known/acme-challenge/ {
rewrite ^/.well-known/acme-challenge/(.*) /$1 break;
root /acme;
}
location / {
# proxy_pass http://localhost:3000;
proxy_pass http://address_ip:3000;
}
location ~* ^.+.(avif|gif|ico|jpg|jpeg|png|webp)$ {
### not use $http_referer
if ($host !~ ^(git.huc.fr.eu.org|www.git.huc.fr.eu.org)$ ) { return 444; }
}
location ~ /*.(jpe?g|gif|png|tiff)$ {
access_log off;
add_header Cache-Control "public, must-revalidate, proxy-revalidate, max-age=31536000";
add_header Pragma public;
add_header Vary "Accept-Encoding";
expires max;
log_not_found off;
# try_files $uri$avif_suffix $uri$webp_suffix $uri =404;
try_files $uri =404;
}
include /etc/nginx/conf.d/server/robots.conf;
But when I attempt to display image PNG, nginx reply with an error 404.
like: https://git.huc.fr.eu.org/hucste/pfstats/src/branch/main/pfstats.html.png
I attempt to disable both locations for image, but result the same problem.
Any idea?