On the Web, there are many Nginx configuration examples for supporting Laravel. The configuration is quite simple, however, when using Laravel 8 the following error might be displayed.


Can only instantiate this object with a string.

The error is not very descriptive but this issue is explicitly addressed in Laravel documentation for versions 4.2~5.3, regarding URL re-writes, which requires adding the following line in the Nginx configuration file.

location / {
try_files $uri $uri/ /index.php?$query_string;
It is not clear why the documentation lacks this information for Laravel versions > 5.3; however, you can add this line in your Nginx configuration if you are facing the same issue.