How to deploy a Laravel application with ISPConfig

Procédure

Deploying a Laravel application on a VPS with ISPConfig is done by configuring your domain and the website in the management panel, then installing the project from the command line with a dedicated account. Laravel is an open source web framework in PHP designed to create robust and modern web applications thanks to a clear and elegant architecture. This complete procedure guides you step by step all the way to displaying the secure HTTPS home page, without needing to use the server's root privileges.

Steps

  1. Create the DNS record for your domain or subdomain

    Go to the management section for your domain, open the DNS Zone tab, then create a new entry. Choose the A type, enter the desired subdomain (for example laravel for laravel.learnlws.fr), enter your VPS server's IP address (e.g. 203.0.113.10), then click Add.

    How to deploy a Laravel application with ISPConfig
  2. Access the ISPConfig interface from the customer area

    From your LWS VPS customer area, locate the Server Administration block and click the Administration Panel button to log in to ISPConfig.

    How to deploy a Laravel application with ISPConfig
  3. Add the website with PHP-FPM and Let's Encrypt

    In ISPConfig, navigate to the Sites menu then click Add new website. Enter your full domain (e.g. laravel.learnlws.fr), select the Auto-Subdomain alias if needed, make sure to check the SSL and Let's Encrypt SSL boxes, set the PHP field to PHP-FPM, choose a recent PHP version, then click Save.

    How to deploy a Laravel application with ISPConfig
  4. Create a Shell user for the project

    In the left-hand menu, go to the Command Line section and click SSH/SFTP-User, then Add new SSH-User. Select your website, enter the username (which will be preceded by an automatic prefix such as defaultlaravelapp), provide a secure password, leave the Chroot Shell setting on None to allow the global execution of PHP tools, then click Save.

    How to deploy a Laravel application with ISPConfig
  5. Create the MySQL database and its user

    In the left-hand menu under Databases, first add a MySQL user via Database Users and assign it a strong password. Then go to Databases, click Add new Database, select your site, name the database, and attach the MySQL user you just defined before validating.

  6. Connect via SSH and deploy the project with Composer

    Open your terminal and connect using your shell user: ssh defaultlaravelapp@203.0.113.10. Check that Composer (the standard dependency manager for PHP) is available with the composer -V command; if it is not yet present, download its executable directly into your account. Move to your hosting directory and initialize the project with composer create-project laravel/laravel . (or clone your Git repository before running composer install).

  7. Configure the .env file, generate the key, and migrate the database

    Edit the .env file at the root of your Laravel project with an editor such as nano: set APP_URL=https://laravel.learnlws.fr and complete the MySQL settings (DB_HOST=203.0.113.10, DB_DATABASE, DB_USERNAME, DB_PASSWORD). Then run the encryption key generation with php artisan key:generate, followed by the migrations with php artisan migrate to create the tables.

  8. Adjust the web public folder and permissions

    Laravel serves its entry point from its public/ subfolder. In ISPConfig, adjust your website's Apache document root directive to point to this public/ folder (or link the web/ folder to public/), then apply the necessary write permissions on the cache and log folders by running chmod -R 775 storage bootstrap/cache.

  9. Check that it works in the browser

    Open your web browser and enter your site address (for example https://laravel.learnlws.fr). The default Laravel home page appears with the SSL security padlock active, confirming the installation was completed successfully.

Essential Artisan commands after deployment

After installing your Laravel application, several Artisan console commands make operation and maintenance of the project easier.

  • php artisan key:generate — generates the unique encryption key essential to application security
  • php artisan migrate — applies the schemas and creates all the tables in your MySQL database
  • php artisan config:cache — caches the configuration files to speed up production performance
  • php artisan route:cache — optimizes the loading of your application routes for visitor requests

Frequently asked questions

Why choose the 'None' option for the user's Chroot Shell?

The 'None' mode allows your user to execute the Debian system's global binaries (notably PHP CLI, Git, and Composer). A standard chrooted environment restricts access and would block the normal execution of Artisan and Composer commands.

Why does the home page show a 500 error after deployment?

An HTTP 500 error generally comes from a missing application key in the .env file (run php artisan key:generate) or insufficient permissions on the storage and bootstrap/cache folders, which must be writable by the web server.

How do you make ISPConfig point directly to Laravel's public subfolder?

You can add a custom Apache directive in the website options on ISPConfig to redefine the DocumentRoot to /var/www/votresite.com/web/public, or replace the standard web folder with a symbolic link pointing to your project's public folder.

Is it necessary to access the server with the root account?

No, all file management operations, Composer dependency installation, .env configuration, and Artisan commands are performed entirely with the shell user attached to the website created in ISPConfig.

The Let's Encrypt SSL certificate is not activating in ISPConfig, what should I do?

Make sure the A-type DNS record points correctly to your VPS's IP address and that propagation has finished. Let's Encrypt checks the domain's accessibility from outside before validating and issuing the certificate.

Useful links

help.lws.net/a/7955
Was this article helpful?

Yes

No

Read 3 times

Thank you! Feel free to ask questions about our documentation if you would like more information, and help us improve it.

Similar articles

A question about this article?

Ask the LWS team and the community. Answers are published after moderation.

Ask the LWS team and its community a question

GDPR: Controller: LWS-Ligne Web Services. Purpose: moderation and public publication of your question, possible notification of an answer. Legal basis: consent (Art. 6(1)(a) GDPR). Email retention: 90 days after notification, 12 months maximum without an answer. To exercise your rights, see the GDPR section of our Terms and Conditions.