Files
QRForge-selfhosted/nginx.conf
T
dillard d59b6d889b Fix nginx 403 on root path when index.php isn't baked into the nginx image
try_files' $uri/ fallback matched the container's document root as an
existing directory and tried to serve a local directory index, but
Dockerfile.nginx only copies static assets (not index.php) into the
nginx image — index.php only exists in the php-fpm container. Without
autoindex, nginx returned 403 for any request to "/". Dropping $uri/
lets it fall straight through to the front-controller fastcgi catch-all.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fo3DiRRpmz2DXjD7Uzhc8u
2026-07-11 16:37:36 +02:00

31 lines
779 B
Nginx Configuration File

server {
listen 80;
server_name _;
root /var/www/html;
index index.php;
client_max_body_size 20m;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "same-origin" always;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass qrforge-app:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# Generated qr codes are stored outside the document root and are only served
# through the authenticated qrcode_image.php / qrcode_zip_download.php endpoints.
location ~ /\. {
deny all;
}
}