When you upload an Laravel project to the server, you must configure the Virtual Host to point to the folder public
of your project, because as the folder name says, this is the folder that should be public.
Thinking about the case of Apache2, you could configure it 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 a development environment.
The archive .env
directly affects the file settings in the folder config
. For example, the file config/database.php
should contain in the second function parameter env
the value referring to the connections in production, since the first parameter will be the parameters defined in the file .env
. If this file is missing, the second parameter of the function env
will be considered for your configuration.
Example:
'host' => env('DB_HOST', 'url-do-banco-em-producao.com')
In the archive .env
DB_HOST=localhost
That is, you only need to send your application’s files to the specific folder on the server, with the exception of the file .env
.
Dedicated or shared server?
– Wallace Maxters