How to Use Vultr's Laravel Marketplace Application

Updated on July 26, 2024
How to Use Vultr's Laravel Marketplace Application header image

Introduction

Laravel is a popular, open-source PHP web framework designed to make web application development more accessible and efficient. It follows the Model-View-Controller (MVC) architectural pattern and provides an elegant syntax that simplifies common tasks like routing, authentication, and caching. Laravel is known for its robust features, such as an ORM (Eloquent), a powerful templating engine (Blade), and comprehensive tooling for tasks like database migrations and testing. It also includes built-in support for task scheduling, queuing, and RESTful APIs, making it a versatile choice for building modern web applications.

This article explains how to use Vultr's Laravel Marketplace Application. You will apply an SSL certificate to an example application. And connect Vultr Managed Database as a storage solution.

Deploy Laravel Marketplace Application on Vultr

  1. Login to your Vultr Customer Portal and click the Deploy Server button.

    deploy-server

  2. Select Optimized Cloud Compute as a server type.

    server-selection

  3. Choose a nearby server location amongst the 32 global locations.

    location-selection

  4. Select Laravel as the Marketplace Application.

    marketplace-app

  5. Select a server size as per requirements.

    server-size

  6. Choose any Additional Features as per requirements.

    additional-features

  7. Click the Deploy Now button to start the instance deployment.

    deploy-server

  8. Once the instance is deployed go to the server details and copy the SSH details.

    server-details

Configure Vultr DNS

  1. Navigate to the Products page.

  2. From the side menu, expand the Network dropdown, and select DNS.

  3. Click the Add Domain button in the center.

  4. Follow the setup procedure to add your domain name by selecting the IP address of your server.

  5. Set the following hostnames as your domain's primary and secondary nameservers with your domain registrar:

    • ns1.vultr.com
    • ns2.vultr.com

Deploy a Laravel Application

  1. Navigate into the Laravel project directory.

    console
    $ cd /var/www/html/my-laravel-app
    
  2. Install Certbot to secure the application with SSL.

    console
    $ sudo apt install certbot && python3-certbot-apache -y
    
  3. Request an SSL certificate for your domain.

    console
    $ sudo certbot --apache -d your_domain.com
    
  4. Update database configuration in config/database.php.

    php
    Copy'mysql' => [
        // ... other configurations ...
        'sslmode' => 'require',
    ],
    
  5. Optional: Deploy a Vultr Managed Database and connect it with the Laravel application.

  6. Open .env file.

    console
    $ nano .env
    
  7. Update .env file with Vultr Managed Database credentials.

    DB_CONNECTION=mysql
    DB_HOST=your_vultr_db_host
    DB_PORT=your_vultr_db_port
    DB_DATABASE=defaultdb
    DB_USERNAME=your_vultr_db_username
    DB_PASSWORD=your_vultr_db_password

    Database details can be retrieved from the Vultr Customer Portal.

    Save and close the file.

  8. Setup firewall rules and allow incoming connections.

    console
    $ sudo ufw allow OpenSSH && sudo ufw allow 'Apache Full'
    
  9. Set proper permissions.

    console
    $ sudo chown -R www-data:www-data /var/www/html/my-laravel-app && sudo chmod -R 755 /var/www/html/my-laravel-app/storage
    
  10. Run migrations.

    console
    $ php artisan migrate
    

Benefits of Laravel Marketplace Application

  • Complete LAMP stack: Comes with Laravel 11.11.1, Apache 2.4.58, MySQL 8.0.37, and PHP 8.3.6 pre-installed and configured, providing a fully functional web development environment out of the box.

  • Security-Ready: Includes Certbot for easy SSL certificate installation, enhancing application security with HTTPS encryption.

  • Development Tools: Pre-installed Composer 2.7.7 for dependency management, and a pre-configured Laravel project structure in /var/www/html/my-laravel-app for immediate development.

  • Optimized Configuration: Apache virtual host files are pre-configured and stored in /etc/apache2/sites-available/, streamlining the setup process for hosting Laravel applications.

  • Latest Framework Features: Includes Laravel's robust ecosystem with features like Eloquent ORM, Blade Templating, Artisan CLI, task scheduling, and real-time event broadcasting capabilities.

Conclusion

In this article, you deployed Vultr's Laravel Marketplace Application. With the pre-installed tools it becomes easier to setup and host a new Laravel Application or migrate and host an existing one.