server {
	listen 80;
	server_name localhost;
	root /var/www/html/public;

	client_max_body_size 4G;
	client_header_buffer_size 1k;
	large_client_header_buffers 4 16k;

	# 2 hours timeout
	proxy_read_timeout 7200s;
    proxy_connect_timeout 7200s;
    proxy_send_timeout 7200s;
    send_timeout 7200s;
    fastcgi_read_timeout 300;

	add_header X-Frame-Options "SAMEORIGIN";
	add_header X-XSS-Protection "1; mode=block";
	add_header X-Content-Type-Options "nosniff";

	index index.html index.htm index.php;

	charset utf-8;

    location ~* ^/storage/.*\.(php|phtml|php5|php7)$ {
        deny all;
        return 404;
    }

    location ~ /\.(env|git) {
        deny all;
        return 404;
    }

	location / {
		try_files $uri $uri/ /index.php?$query_string;
	}

	location /app {
        # Uncomment this to enable logging
		#access_log /var/log/nginx/colibriplus_ws_access.log;
		#error_log /var/log/nginx/colibriplus_ws_error.log debug;

        proxy_http_version 1.1;
        proxy_set_header Host $http_host;
        proxy_set_header Scheme $scheme;
        proxy_set_header SERVER_PORT $server_port;
        proxy_set_header REMOTE_ADDR $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass http://reverb:13000;

		# Ensure this matches your Reverb server's host and port
    }

	location = /favicon.ico { access_log off; log_not_found off; }
	location = /robots.txt  { access_log off; log_not_found off; }

	error_page 404 /index.php;

	location ~ \.php$ {
		try_files $uri =404;
		fastcgi_split_path_info ^(.+\.php)(/.+)$;

        # Change your PHP version to the one you are using.
        # Sometimes socket files are located in different locations.
        # check your php version and socket file location.

		#fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
		fastcgi_pass colibriplus:9000;
		fastcgi_index index.php;
		include fastcgi_params;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_param PATH_INFO $fastcgi_path_info;
	}

	location ~* \.(jpg|jpeg|gif|png|css|js|ico|svg|woff|woff2|ttf|otf|eot|ttf|ttc|map|mp4|webm|ogg|ogv|webp|zip|rar|tar|gz|bz2|7z)$ {
		expires max;
		log_not_found off;
	}
}
