server {
	listen 80 default_server;
	listen [::]:80 default_server;

	server_name localhost;
	root /var/www/html;

	error_log  /var/log/nginx/error.log;
	access_log /var/log/nginx/access.log;

	add_header X-Frame-Options "SAMEORIGIN";
	add_header X-Content-Type-Options "nosniff";
	
	index index.html index.php;

	charset utf-8;

	# prevent port change when rewriting
	# port_in_redirect off;
	# server_name_in_redirect off;
	# absolute_redirect off;

	error_page 404 /index.php;

	proxy_read_timeout 2m;
	proxy_connect_timeout 2m;
	proxy_send_timeout 2m;

	client_max_body_size 20m;

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

	location ~ /\.(?!well-known).* {
        deny all;
    }

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

    location ~ \.php$ {
		try_files $uri =404;
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass app:9000;
		fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
		fastcgi_param PATH_INFO $fastcgi_path_info;
    }

	location /trucking {
		alias /var/www/html/trucking/public;
		index index.php;
		try_files $uri $uri/ @trucking;

		location ~ \.php$ {
			include fastcgi_params;
			fastcgi_pass app:9000;
			fastcgi_param SCRIPT_FILENAME /var/www/html/trucking/public/index.php;
		}
	}
	location @trucking {
		rewrite /trucking/(.*)$ /trucking/index.php?/$1 last;
	}
}