When you upload a Laravel project to the server, you must configure Virtual Host to point to the public
folder of your project, because as the name of the folder says, this is the folder that should be public.
Thinking about the Apache2 case, you could set it up as follows:
<VirtualHost *:80>
DocumentRoot /var/www/nome-do-projeto/public
ServerName www.nome-do-projeto.com.br
ErrorLog /tmp/nome-do-projeto_apache.log
</VirtualHost>
It is also necessary to remove the file .env
, since it should only be used in the development environment.
The .env
file directly affects the file settings in the config
folder. For example, the config/database.php
file must contain in the second parameter of the env
function the value for the connections in production, because the first parameter will be the parameters defined in the .env
file. In the absence of this file, the second parameter of the env
function will be considered for its configuration.
Example:
'host' => env('DB_HOST', 'url-do-banco-em-producao.com')
In the file .env
DB_HOST=localhost
That is, you only need to send the files of your application to the specific folder on the server, with the exception of the file .env
.