I disagree with the above answer of @Jean-Roch B. and agree with the comment of @Tpojka.
If the root of the "web directory" on your server is /var/www you should put Laravel in that folder
No. The root directory (DocumentRoot as defined by https://httpd.apache.org/docs/2.4/mod/core.html#documentroot) is aimed to allow the HTTP server to provide the client the files recursively under. Meaning that siblings and recursively parents directories can't be provided to the client.
What does it means? That if you put Laravel recursively under the root directory, you will have a security issue. For example, the config and environment files, your controllers, your migration files etc., would be provided to the client if this latter asks for them.
By saying the following:
Laravel should always be served out of the root of the "web directory" configured for your web server. You should not attempt to serve a Laravel application out of a subdirectory of the "web directory". Attempting to do so could expose sensitive files present within your application.
, Laravel docs are saying to NOT put the Laravel directory recursively under the document root. YOU ABSOLUTELY MUST PUT THE LARAVEL DIRECTORY RECURSIVELY ABOVE THE DOCUMENT ROOT.
The document root, with a Laravel site, must ONLY point to the directory app/public of the Laravel directory.
I will quote @Tpojka (see his comment to the OP's question), who is absolutely right:
Nothing outside public directory shouldn't be available to external access. Only public directory should be accessible by externals. Everything else is lot of work on securing application.
Also, quoting again @Jean-Roche B.:
Obviously it's not a good idea to put Laravel in /var/otherdirectory or /otherdirectory
, if like he was saying /var contains /var/www, I thin rather that Laravel could actually be put in /var, delete www, and make the root directory be the app/public directory (this is an example).
To end: the DocumentRoot can normally be configured in your Web Host configuration admin panel.