events{}

http {
	include       /etc/nginx/mime.types;

	server {
		listen 443 ssl;
		listen [::]:443 ssl;

		ssl_protocols   TLSv1.2 TLSv1.3;

		# SSL certificates
		ssl_certificate /etc/nginx/ssl/inception.crt;
		ssl_certificate_key /etc/nginx/ssl/inception.key;

		root /var/www/html;
		index index.php index.html;

		server_name fgras-ca.42.fr;

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

		location ~ \.php$ {
			fastcgi_split_path_info ^(.+\.php)(/.+)$;
			fastcgi_pass wordpress:9000;
			fastcgi_index index.php;

			include fastcgi_params;
			fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  # Full path to the script file
			fastcgi_param PATH_INFO $fastcgi_path_info;  # Extra path information
			fastcgi_param QUERY_STRING $query_string;  # Query string
			fastcgi_param REQUEST_METHOD $request_method;  # HTTP request method
			fastcgi_param CONTENT_TYPE $content_type;  # Content type
			fastcgi_param CONTENT_LENGTH $content_length;  # Content length
			fastcgi_param SERVER_NAME $server_name;  # Server name
			fastcgi_param SERVER_PORT $server_port;  # Server port
		}
	}
}
