Laravel hosting: files, database, and document root

Updated 1 week ago 15 views

Prepare the application

Check that your hosting supports the PHP version and extensions required by your Laravel release. Build the application's dependencies and frontend assets using its deployment instructions. Ask support if the required tools or access are unavailable on your plan.

Configure the website

  1. Keep the Laravel project files outside the publicly served folder wherever possible.
  2. Configure the domain's document root to the application's public directory. The project root must not be exposed as the website root.
  3. Create a database and database user in vPanel if your application needs one. Enter that account's actual connection details in the application's environment configuration.
  4. Set APP_ENV=production, APP_DEBUG=false, and APP_URL to the correct HTTPS website address.
  5. Follow the application's instructions for its application key, database migrations, storage link, and caches. Take a database backup before running changes against existing data.
  6. Allow the application to write to its storage and cache directories with appropriate ownership and permissions. Avoid making everything writable.

Verify the result

Test the home page, sign-in, forms, and uploaded files. Confirm that private configuration, source files, and database backups cannot be downloaded through the website.

Never post your .env file, database password, application key, or private keys in a ticket. Share the error text with sensitive values removed.

Still need help?

If this article did not answer your question, our support team can help.

Contact support
Top