On a droplet, I have created two Linux user accounts and setup Laravel 5 for each of them at the following paths:
I installed Laravel through composer and at the root of each Laravel install, I notice a .env file, which has the Laravel API key automatically written to it. But, that file also has a whole bunch of other variables, including the following:
APP_ENV=local
APP_DEBUG=true
APP_KEY=Key(obfuscated)
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
etc.
The default Laravel page loads when I try https://dev.example.com and https://beta.example.com (installed LetsEncrypt and redirected all requests to https), but I am a bit confused if it’s also necessary to specify the details in the respective .env files as below:
APP_ENV=dev
APP_DEBUG=true
APP_KEY=Key(obfuscated)
APP_URL=https://dev.example.com
and, also specify the respective db details.
Thanks in advance.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Yes, you will want to fill out the
.env
file with your settings as Laravel automatically loads all the settings in that file, stores them in$_ENV
and supplies them to theenv()
helper function that is used across all the codebase.Check out the official documentation for more details: