{"id":1912,"date":"2025-03-28T16:16:04","date_gmt":"2025-03-28T14:16:04","guid":{"rendered":"https:\/\/upcloud.com\/global\/us\/resources\/tutorials\/build-deploy-and-scale-laravel-apps-quickly-using-upclouds-fast-cloud-servers\/"},"modified":"2025-03-28T16:16:04","modified_gmt":"2025-03-28T14:16:04","slug":"build-deploy-and-scale-laravel-apps-quickly-using-upclouds-fast-cloud-servers","status":"publish","type":"tutorial","link":"https:\/\/upcloud.com\/global\/resources\/tutorials\/build-deploy-and-scale-laravel-apps-quickly-using-upclouds-fast-cloud-servers\/","title":{"rendered":"Build, Deploy, and Scale Laravel Apps Quickly Using UpCloud\u2019s Fast Cloud Servers"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Laravel is a popular open-source framework that makes it easy for developers to build web applications. It offers out-of-the-box components and features that can be included in a project to provide different functionality for a web application.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In other words, instead of building an authorization function from scratch, or having to write your own code with low-level details for interacting with a caching system, you can make use of pre-written code packages that are secure, efficient, and performant.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Laravel prioritizes the ease-of-use by offering an elegant, expressive, and simple syntax that can be quickly learnt, understood, and implemented, making it a very popular framework among developers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, developing and building an application is only one part of the story, or \u2013 as the saying goes \u2013 \u201can application running on a developer\u2019s machine doesn\u2019t generate revenue\u201d. So, in order for your application to come to life it needs to be deployed on a production server somewhere. Needless to say, this server and other related infrastructure components should provide the required performance, reliability, and scalability for the application. This leaves us with a simple answer to these requirements, which is the \u201cCloud\u201d.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Combining the features of Laravel with the capabilities of a Cloud infrastructure, we can have a complete solution for building, deploying, and scaling our applications starting from the development phase, and up to the live production environment. All while providing high performance and extreme scalability.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this guide, we\u2019re going to cover the step-by-step process for building a Laravel app and deploying it to a Cloud server on UpCloud. Whether you\u2019re a complete beginner or have prior experience with Cloud deployments, you\u2019ll be able to understand the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>How to setup Laravel and the key components of a Laravel project<\/li>\n\n\n\n<li>How to create, build, and locally test a Laravel project<\/li>\n\n\n\n<li>How to create a Cloud server with the required configuration to deploy your application<\/li>\n\n\n\n<li>How to scale and optimize your server for best performance<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">By the end of this guide, you\u2019ll have a running Laravel application that is deployed on a Cloud environment and making use of its underlying infrastructure scalability and performance features.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before diving into our scenario, make sure you go through the following checklist to be able to follow along with this guide:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Create an <\/strong><a href=\"https:\/\/signup.upcloud.com\/\"><strong>UpCloud account<\/strong><\/a><strong>:<\/strong> This gives you access to different UpCloud services using the GUI control panel, <a href=\"https:\/\/upcloud.com\/global\/resources\/tools\/upcloud-command-line-interface\">command-line interface<\/a>, or the <a href=\"https:\/\/upcloud.com\/global\/resources\/tools\/category\/api-clients\">API<\/a>.<\/li>\n\n\n\n<li><a href=\"https:\/\/upcloud.com\/global\/resources\/tutorials\/deploy-server\"><strong>Deploy a Cloud server on UpCloud<\/strong><\/a><strong>:<\/strong> This is going to be our target server where we\u2019ll deploy our application.<\/li>\n\n\n\n<li><strong>Install PHP and composer:<\/strong> Laravel uses PHP as its core, so you\u2019ll need to have PHP and composer installed in your environment before running Laravel. For this guide, we\u2019ll be running on Ubuntu so you can <a href=\"https:\/\/www.php.net\/manual\/en\/install.unix.debian.php\" target=\"_blank\" rel=\"noopener\">use the apt package manager to install PHP<\/a>. For composer, you can <a href=\"https:\/\/getcomposer.org\/doc\/00-intro.md#installation-linux-unix-macos\" target=\"_blank\" rel=\"noopener\">download and use its installer<\/a> from the command line.&nbsp;&nbsp;<\/li>\n\n\n\n<li><strong>Familiarity with using the CLI:<\/strong> We\u2019ll be using some basic commands throughout this guide to install our tools, navigate project directories, and work with SSH.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Setting Up Laravel<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The first step in our scenario is to prepare our local environment by installing the Laravel framework. There are two common ways to install Laravel:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Directly using composer: This will use composer to create your Laravel project and download all required Laravel files with the following command:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>composer create-project --prefer-dist laravel\/laravel &lt;Project-name&gt;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using Laravel installer: The Laravel installer is a package that makes it easy to create and setup a Laravel project. You can download this package with the following command:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>composer global require laravel\/installer<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Then you\u2019ll be able to create your Laravel project using the following command:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>laravel new &lt;Project-name&gt;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Install Laravel on the Cloud Server<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now after preparing the local environment, we\u2019ll also need to install Laravel on our Cloud server with the following steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/upcloud.com\/global\/resources\/tutorials\/deploy-server\">Deploy the server on UpCloud<\/a> if you haven\u2019t already done so. For this guide, I\u2019ve created the Cloud server with the Ubuntu operating system, so I\u2019ll be installing Laravel on Ubuntu.<\/li>\n\n\n\n<li>Connect to the server using SSH. You\u2019ll first need to <a href=\"https:\/\/upcloud.com\/global\/docs\/guides\/use-ssh-keys-authentication\/\">generate an SSH key<\/a> and then connect to the server using the server\u2019s IP address and the generated SSH key. You can find the instructions for different operating systems in the <strong><em>How to connect<\/em><\/strong> section under the server information in the UpCloud control panel:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel1-1024x598.png\" alt=\"-\" class=\"wp-image-48698\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Since I\u2019m connecting from a local Linux environment, I\u2019ll use the following command:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>ssh -i SSH-key root@IP-address<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><br>Make sure you replace <strong><em>SSH-key<\/em><\/strong> with your SSH key file, and <strong><em>IP-address<\/em><\/strong> with your server IP.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel2-1024x543.png\" alt=\"-\" class=\"wp-image-48699\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Now that I\u2019m connected to my Cloud server, I\u2019ll use the composer method to install Laravel with the command <code>composer create-project --prefer-dist laravel\/laravel &lt;Project-name&gt;<\/code>. You\u2019ll need to already have PHP and composer installed:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel3-1024x536.png\" alt=\"-\" class=\"wp-image-48700\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Finally, we can verify that everything is installed correctly on our Cloud server by checking and navigating to our project folder using the following commands:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\"><code>cd myProject\nls<\/code><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel4-1024x542.png\" alt=\"-\" class=\"wp-image-48701\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Create and Test a Laravel App Locally<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we have prepared our local and Cloud server environments, the next step is to create a simple Laravel application. We\u2019ll start by creating the application locally, I\u2019ll again use the composer method:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>composer create-project --prefer-dist laravel\/laravel myProject<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><br>Next let\u2019s navigate to our project directory and start our local development server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">cd myProject\nphp artisan serve<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>php artisan serve<\/code> command starts the <a href=\"https:\/\/www.php.net\/manual\/en\/features.commandline.webserver.php\" target=\"_blank\" rel=\"noopener\">built-in web server<\/a> of PHP. This is useful for quickly testing your application on the local development environment without the need to install a dedicated web server like Apache or Nginx.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-101-1024x572.png\" alt=\"-\" class=\"wp-image-48702\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As we can see in the above image, our local development server is started and listening for requests on port 8000. Now let\u2019s test accessing our application from the same local environment with the following command:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>curl localhost:8000<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-102-1024x500.png\" alt=\"-\" class=\"wp-image-48703\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As we can see, we\u2019re able to get the response from our server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Building Your Laravel App<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In the previous section, we tested the sample Laravel code provided for us by default when we created our project. Now let\u2019s understand the different components that make up our application so that we can add some functionality to it using these components.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Laravel follows the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Glossary\/MVC\" target=\"_blank\" rel=\"noopener\">MVC design pattern<\/a> principles, which makes the project code maintainable, scalable, and well-structured. The main components of a Laravel project are as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Routes: A route provides a way to map a specific URL path to a specific action to be executed. For example, we might want to display a welcome message when a user sends a <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Methods\/GET\" target=\"_blank\" rel=\"noopener\">GET request<\/a> to our application on the <code>\/welcome<\/code> URL. In that case, we define a route with the <code>\/welcome <\/code>endpoint that triggers a function which displays the welcome message.<\/li>\n\n\n\n<li>Model: A model handles different operations related to the data in our application. It is responsible for storing, retrieving, and manipulating different data structures used in our application. A model usually interacts with external data stores like an SQL database or an in-memory cache.<\/li>\n\n\n\n<li>View: This is simply the part of our application that provides the user interface that a client interacts with. It is responsible for presenting the state of the data in our application or receiving user input to manipulate this data.<\/li>\n\n\n\n<li>Controller: A controller is responsible for the business logic and is usually implemented as a Class with a set of methods each handling a specific functionality. A controller also sits in between the view and the model to manage the data exchange between them.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In the default Laravel project directory structure, each of the above components can be found in a specific location. For example, the routes are defined under the <code>\/routes <\/code>directory in the project\u2019s root as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel5-1024x314.png\" alt=\"-\" class=\"wp-image-48767\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In the above image, we navigated to the <code>\/routes <\/code>directory under the project\u2019s root, then inside the <code>\/routes <\/code>directory we viewed the contents of the <code>web.php <\/code>file. This is where our routes are going to be defined. Currently, there\u2019s a single route for the root <code>(\u201c\/\u201d)<\/code><strong><em> <\/em><\/strong>URL which returns a view called <code>welcome<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now let\u2019s check this <code>welcome<\/code> view. Views in Laravel\u2019s directory structure are located under <code>resources\/views<\/code> as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel6-1024x353.png\" alt=\"-\" class=\"wp-image-48768\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As we can see, under the <code>resources\/views<\/code> there\u2019s a single file called <code>welcome.blade.php<\/code>. The first part of the file name is the view name, which is <code>welcome<\/code>. The <code>.blade.php<\/code> extension specifies that the file is using the <a href=\"https:\/\/laravel.com\/docs\/12.x\/blade\" target=\"_blank\" rel=\"noopener\">blade templating language<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Inside the file, we can see some HTML content which is the same as what we\u2019ve seen when we sent a request to our application in the previous section using the <code>curl<\/code> command on port 8000.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So, how did this flow work?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When we typed <code>\u201c<em>curl localhost:8000<\/em>\u201d<\/code>, we were sending an HTTP GET request to our application, since we didn\u2019t specify any path URL in our request, it was sent to the root (<code>\u201c\/\u201d<\/code>) or home page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This request matched the configured route that we\u2019ve seen under the <code>\/routes<\/code> directory, which registers a route for the root (<strong><em>\u201c\/\u201d<\/em><\/strong>) path. So, the function inside this route was triggered and it called the <code>welcome <\/code>view.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, our <code>welcome <\/code>view returned the HTML contents that it contains in the response, after applying the required templating using the blade language.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-105-1024x631.png\" alt=\"-\" class=\"wp-image-48770\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now let\u2019s make some small changes to our Laravel project. First, we\u2019ll replace the contents of the <code>welcome <\/code>view with the following code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">&lt;html&gt;\n&nbsp; &nbsp; &lt;body&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;h1&gt;Hello world from Laravel&lt;\/h1&gt;\n&nbsp; &nbsp; &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-106-1024x446.png\" alt=\"-\" class=\"wp-image-48771\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Next we\u2019ll create another view called <code>greeting<\/code> with the following content:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">&lt;html&gt;\n&nbsp; &nbsp; &lt;body&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;h1&gt;How are you, {{ $name }}&lt;\/h1&gt;\n&nbsp; &nbsp; &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-107-1024x476.png\" alt=\"-\" class=\"wp-image-48772\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now let\u2019s create another route that calls this <strong><em>greeting<\/em><\/strong> view by adding the following code to our <strong><em>web.php<\/em><\/strong> file under the <strong><em>\/routes<\/em><\/strong> directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">Route::get('\/{name}', function ($name) {\n    return view('greeting', ['name' =&gt; $name]);\n});<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-108-1024x444.png\" alt=\"-\" class=\"wp-image-48839\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So what we did here is that we registered a new route with the URL <code>\/{name}, <\/code>meaning that a dynamic value can be passed in the request path after the<strong><em> <\/em><\/strong><code>(\u201c\/\u201d)<\/code><strong><em> <\/em><\/strong>and it will replace the <code>name<\/code> variable. Next we call the <code>greeting<\/code> view, and we\u2019re telling it to replace the <code>{{ $name }} <\/code>placeholder in the blade template with the value of the <code>$name <\/code>variable, which was originally received in the request.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now let\u2019s start our local development server using the <code>php artisan serve <\/code>command (make sure you issue the command from the project\u2019s root directory):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-109-1024x442.png\" alt=\"-\" class=\"wp-image-48840\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Next let\u2019s test our routes by sending requests to each path URL:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-110-1024x469.png\" alt=\"-\" class=\"wp-image-48841\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As we can see, we\u2019re able to get the response from the view corresponding to each route.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can also see our requests showing in the output of our server logs:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-111-1024x364.png\" alt=\"-\" class=\"wp-image-48842\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we\u2019ve built our Laravel app, the next step is to deploy it to our Cloud server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Deploying Laravel to the Cloud Server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There are multiple ways to deploy our Laravel project from the local environment to the Cloud server. For this guide, we\u2019re going to use <a href=\"https:\/\/git-scm.com\/\" target=\"_blank\" rel=\"noopener\">Git<\/a> following this procedure:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.github.com\/en\/repositories\/creating-and-managing-repositories\/creating-a-new-repository\" target=\"_blank\" rel=\"noopener\">Create a Github repository<\/a> under your Github account. This will be the remote repository where we\u2019ll push and share our local Laravel project.<\/li>\n\n\n\n<li>Initialize the Laravel project\u2019s directory as a local Git repository with the following command:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">git init -b main<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This will set the default branch name as <code>main<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-112-1024x343.png\" alt=\"-\" class=\"wp-image-48843\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add all the project files in the working directory to the staging area and create a new commit with the following commands:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">git add .\ngit commit -m &lt;Your commit message&gt;<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel7-1024x392.png\" alt=\"-\" class=\"wp-image-48844\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Something that\u2019s worth mentioning here is the <code>vendor\/ <\/code>directory. This is the location where PHP composer downloads the required dependencies. It can be ignored when pushing the Laravel project to the Github repository, and then we can download the dependencies again using composer on the target server where we deploy our application.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Set the new Github repository as a remote for this local repository with the following command:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">git remote add origin &lt;Github repository URL&gt;<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-113-1024x457.png\" alt=\"-\" class=\"wp-image-48845\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Push your local repository to the remote Github repository with the following command:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">git push -u origin main<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-114-1024x406.png\" alt=\"-\" class=\"wp-image-48846\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li> Connect to your Cloud server using SSH:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel8-1024x695.png\" alt=\"-\" class=\"wp-image-48847\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Clone the Github repository on the Cloud server with the following command:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">git clone &lt;Repository URL&gt;<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel9-1024x426.png\" alt=\"-\" class=\"wp-image-48849\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now we can see that our project\u2019s content is deployed to the Cloud server with the changes we made in the routes and views.<br><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Set up Apache Web Server to Serve the App<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In our local environment, the PHP built-in web server was enough to test our changes quickly and easily. However, when we deploy our Laravel app to a production server, we need a more powerful web server to handle user requests. For this guide, we\u2019ll be using <a href=\"https:\/\/httpd.apache.org\/\" target=\"_blank\" rel=\"noopener\">Apache<\/a> as our web server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can install Apache on our Ubuntu Cloud server with the following steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Update the package index files using the command <code>sudo apt update<\/code><\/li>\n\n\n\n<li>Install the Apache package using the command <code>sudo apt install apache2 -y<\/code>&nbsp;<\/li>\n\n\n\n<li>Verify the status of the service using the command <code>sudo systemctl status apache2<\/code> <\/li>\n\n\n\n<li>If everything is working fine, you should see the service status as active<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel10-1024x433.png\" alt=\"-\" class=\"wp-image-48851\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Test the Apache web server by opening a web browser to the server IP address:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel11-1024x655.png\" alt=\"-\" class=\"wp-image-48852\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we have our Apache web server running, we need to configure it to work with our Laravel application.<br><br>We can apply this configuration in multiple ways, for example, we can modify the main <code>apache2.conf <\/code>file directly, or we can create a separate <a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/vhosts\/\" target=\"_blank\" rel=\"noopener\">virtual host<\/a> configuration.\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For this guide, we\u2019ll be using a virtual host configuration to host our Laravel app following this procedure:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Move the Laravel project\u2019s directory under the Apache web root directory:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sudo mv &lt;Your Laravel project directory> \/var\/www\/html<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Navigate to the apache sites-available configuration directory:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">cd \/etc\/apache2\/sites-available\/<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A default template configuration for virtual host is provided under a file called <code>000-default.conf<\/code>, make a copy of this file to create a virtual host for our Laravel app:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sudo cp 000-default.conf laravel-app.conf<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Replace the contents of the new file with the following:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">&lt;VirtualHost *:80>\n\u00a0 \u00a0 ServerAdmin admin@example.com\n\u00a0 \u00a0 ServerName &lt;Your server IP address\/hostname>\n\u00a0 \u00a0 DocumentRoot \/var\/www\/html\/&lt;Your Laravel project directory>\/public\/\n\u00a0 \u00a0\n\u00a0 \u00a0 &lt;Directory \/var\/www\/html\/&lt;Your Laravel project directory>>\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 AllowOverride All\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Require all granted\n\u00a0 \u00a0 &lt;\/Directory>\n\u00a0 \u00a0\n\u00a0 \u00a0 ErrorLog ${APACHE_LOG_DIR}\/error.log\n\u00a0 \u00a0 CustomLog ${APACHE_LOG_DIR}\/access.log combined\n&lt;\/VirtualHost><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><br>There are a couple of important things to note in the above configuration. The <code>ServerName<\/code><strong><em> <\/em><\/strong>here will be used by Apache when checking the <code>Host<\/code> in the requests sent to the server. If you don\u2019t have a DNS server where your host name is mapped to the server IP, you should use the server IP address directly in this <code>ServerName <\/code>configuration.<br><br>Replace <code>&lt;Your Laravel project directory> <\/code>with the directory name that includes your Laravel project files (the one we moved previously). This will allow Apache to locate the<code> index.php<\/code> file which is the entry point for requests sent to the Laravel application.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel12-1024x419.png\" alt=\"-\" class=\"wp-image-49034\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Enable the Apache rewrite module, enable the Laravel virtual host, and then restart the Apache service with the following commands:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sudo a2enmod rewrite\nsudo a2ensite laravel-appsudo systemctl restart apache2<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Prepare Environment Configuration and Database<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Decoupling the configuration from application code is a common pattern that allows the application to be more maintainable and portable across different environments. Laravel uses a simple <code>.env <\/code>file to provide different environment configurations to an application.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This <strong><em>.<\/em><\/strong><code>env <\/code>file is created for you by default in the project\u2019s root directory, and it can be modified according to your needs and environment specifics.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For the purpose of this guide, we\u2019ll only be going through the database configuration inside the <code>.env<\/code> file, but most of the other configurations should be pretty descriptive and easy to understand.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now let\u2019s view our <code>.env <\/code>file and check the database configuration:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-126-1024x562.png\" alt=\"-\" class=\"wp-image-49035\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As we can see, we\u2019ve a typical database connection configuration that currently has some default values. Now we need to create a database instance and populate these configurations with our instance details.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A simple, yet powerful option is to use a Cloud managed database instance. Managed databases take the heavy lifting of provisioning and setting up the database server, and reduces the maintenance and operational overhead.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can use <a href=\"https:\/\/upcloud.com\/global\/docs\/guides\/set-up-upcloud-managed-databases\/\">UpCloud managed databases<\/a> which offer a variety of the most popular database engines like PostgreSQL and MySQL. For this guide, we\u2019ll be using the UpCloud PostgreSQL managed database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After you <a href=\"https:\/\/upcloud.com\/global\/docs\/guides\/set-up-upcloud-managed-databases\/\">create your UpCloud managed database<\/a>, you can get all the database connection details from the UpCloud control panel under your database instance:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-127-1024x630.png\" alt=\"-\" class=\"wp-image-49036\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Next we can add the database details to our <code>.env<\/code> file:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-128-1024x477.png\" alt=\"-\" class=\"wp-image-49037\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After the configuration is added to the <code>.env<\/code> file, we need to set up the database schema by running the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">php artisan migrate<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After the migration is complete, let\u2019s try to access our application routes from a browser:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-129-1024x599.png\" alt=\"-\" class=\"wp-image-49038\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-130-1024x603.png\" alt=\"-\" class=\"wp-image-49039\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As we can see, our previously configured routes are providing the correct response.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Scaling the Laravel Application<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Availability and performance are of the top priorities for almost any application. Users definitely won\u2019t like to access an application and find its services to be down, or slowly processing their requests. So, there\u2019s always a tight relation between these two requirements and customer satisfaction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The ability to scale your application on-demand to satisfy the changing availability and performance requirements is a crucial part of any deployment, and that\u2019s where Cloud services really shine the most.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Instead of having to manually provision additional infrastructure on your own, and calculate a lot of costs up-front according to estimations, Cloud services facilitate the scaling process by offering capacity resources that can be provisioned and released on-demand, and \u2013 most importantly \u2013 you only pay for what you use, no upfront estimations or CAPEX investments required.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now applying this to our scenario, just having a functional application running on the Cloud server is not the end of the story. We\u2019ve to understand how we can scale this application when there\u2019s a demand.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">UpCloud offers different ways to scale our Cloud servers, let\u2019s explore how to implement each of them.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Vertical Scaling using Hot Resize<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Vertical scaling \u2013 also called scaling up \u2013 refers to the process of scaling our servers by adding more compute resources. For example, if we upgrade a server instance from 4GBs of RAM to 8GBs of RAM, this is a scale up process.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since vertical scaling involves modifying the hardware configuration of the server, it usually requires taking the server down for some time to apply these changes, which causes some down time for the applications running inside this server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">UpCloud provides a seamless scale-up feature called<code> Hot resize<\/code> that allows adding more resources to a Cloud server without the need to shutdown the server. Let\u2019s apply this to our server:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>From the UpCloud control panel, select the server you want to scale up<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel14-1024x513.png\" alt=\"-\" class=\"wp-image-49042\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to the plan tab and check the current and available plans.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel15-1024x580.png\" alt=\"-\" class=\"wp-image-49043\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Select the target plan you want to scale up to.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel16-1024x632.png\" alt=\"-\" class=\"wp-image-49044\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Click on Save changes at the bottom of the page<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel17-1024x540.png\" alt=\"-\" class=\"wp-image-49045\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>And we have our additional resources added to the server without application downtime.<br><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel18-1024x644.png\" alt=\"-\" class=\"wp-image-49046\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Horizontal Scaling using a Load Balancer<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Horizontal scaling \u2013 also called scaling out \u2013 is the process of scaling our application by adding more server instances. Usually, all the server instances are replicas of each other and contain the same application code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Scaling out can sometimes provide some advantages compared to scaling up. For example, in a scaling up scenario you might be limited by a maximum amount of resources a single instance can include, while scaling out can add as many instances as you need. Another significant advantage for the scaling out is that it increases the availability and not only the performance, as you\u2019ll have multiple instances serving your application traffic, a failure in one instance will not take your application down completely.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, scaling out configurations are usually more complex than those of scaling up. Scaling out typically involves creating multiple replicas from the server, and properly configuring a load balancer to distribute the traffic across the server instances.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now let\u2019s walk through the steps for scaling out our application on UpCloud:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Creating additional instances from our server: The first step is that we need to create additional Cloud servers that are replicas from our current server and contain the same application. Instead of creating these servers from scratch, UpCloud provides a simple option by cloning our current server<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel19-1024x627.png\" alt=\"-\" class=\"wp-image-49050\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The cloning feature requires that we shutdown our server first:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel20-1024x618.png\" alt=\"-\" class=\"wp-image-49051\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>As we can see, the Clone option became available after the server was stopped.<\/li>\n\n\n\n<li>Provide the configuration you want for the new server and click on Clone at the bottom of the page:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel21-1024x781.png\" alt=\"-\" class=\"wp-image-49052\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Once the clone operation is finished we\u2019ll be able to see both servers in our server list.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel22-1024x382.png\" alt=\"-\" class=\"wp-image-49053\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Modify required Apache\/Laravel configuration: Some configuration inside the server might need to be changed. For example, I\u2019m going to change the virtual host configuration to provide the new server IP address.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel23-1024x518.png\" alt=\"-\" class=\"wp-image-49055\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>I\u2019m also going to modify the <code>welcome <\/code>view in the Laravel project to indicate that it\u2019s coming from the other server.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel24-1024x477.png\" alt=\"-\" class=\"wp-image-49056\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We can verify it\u2019s working fine by connecting to the new server IP from a browser.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel25-1024x517.png\" alt=\"-\" class=\"wp-image-49059\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/upcloud.com\/global\/resources\/tutorials\/configure-sdn-private-networks\">Create a private network<\/a>: Private networks allow servers and resources to communicate with each other using private IPs on an isolated network as if they were connected to a network switch.<\/li>\n\n\n\n<li>Attach the servers to the private network: Under the network tab of your server, select attach SDN private network and choose the network you created earlier.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel26-1024x632.png\" alt=\"-\" class=\"wp-image-49060\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Now the next step is to <a href=\"https:\/\/upcloud.com\/global\/resources\/tutorials\/get-started-upcloud-load-balancer\">create a Load Balancer<\/a> to distribute the traffic across the 2 servers. Make sure you create the Load Balancer in the same location as your servers and attach it to the same private network.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel27-1024x733.png\" alt=\"-\" class=\"wp-image-49061\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/laravel28-1024x774.png\" alt=\"-\" class=\"wp-image-49062\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>After adding the necessary <a href=\"https:\/\/upcloud.com\/global\/resources\/tutorials\/get-started-upcloud-load-balancer\">backend and frontend configuration<\/a> we should be able to reach our application through the Load Balancer.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" data-id=\"49063\" src=\"https:\/\/upcloud.com\/media\/laravel29-1024x578.png\" alt=\"-\" class=\"wp-image-49063\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" data-id=\"49064\" src=\"https:\/\/upcloud.com\/media\/laravel30-1024x528.png\" alt=\"-\" class=\"wp-image-49064\" \/><\/figure>\n<\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We can also see that the request is served from the 2 different servers.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices for Laravel Deployment<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Just getting a functional Laravel application might not be sufficient for a production environment. We need to improve our deployment further by implementing additional configurations that satisfy more application requirements. These requirements can roughly be divided into the following pillars:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Security: Secure your app by using encrypted HTTPS connections to the web server instead of plain HTTP, incorporate Laravel\u2019s authentication and authorization features into your app, and implement fine-grained access control and firewall configuration on your Cloud servers.<\/li>\n\n\n\n<li>Performance: Make use of UpCloud scalability features to dynamically adjust your server infrastructure resources for responding to the change in application demand. Leverage the global presence of UpCloud services to deploy your app in multiple locations that are closer to your clients, and implement caching and CDN techniques to improve your app response time and latency.<\/li>\n\n\n\n<li>Availability\/Disaster Recovery: Boost your application\u2019s uptime by implementing techniques such as clustering, load balancing, and replication. Leverage UpCloud <a href=\"https:\/\/upcloud.com\/global\/resources\/tutorials\/taking-backups\">server backup<\/a> features and tailor it for your specific needs.<\/li>\n\n\n\n<li>Observability and Monitoring: Supercharge your deployment by implementing appropriate metrics, logging, and tracing solutions that give you insights about your application behavior. Analyzing the data from these solutions can dramatically support your application design and operational decisions. You can use the built-in statistics and monitoring data provided by UpCloud for their different services or use additional tools like <a href=\"https:\/\/prometheus.io\/\" target=\"_blank\" rel=\"noopener\">Prometheus<\/a>, <a href=\"https:\/\/www.elastic.co\/elasticsearch\" target=\"_blank\" rel=\"noopener\">Elasticsearch<\/a>, and <a href=\"https:\/\/grafana.com\/\" target=\"_blank\" rel=\"noopener\">Grafana<\/a>.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Laravel is a popular web application framework that provides an elegant and simple syntax for developers. It offers out-of-the-box security, performance, and scalability features. We can boost the performance of our Laravel application even more by deploying it to a Cloud environment and making use of the massive scalability of the Cloud.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this guide, we covered how to build, deploy, and scale a Laravel application. We used UpCloud high performance servers to install and set up Laravel. Then we explored the different components of a Laravel project and added some functionality to our application. After that we deployed our Laravel application to the Cloud server and installed Apache to serve web requests. Finally, we checked the different methods that UpCloud offers for scaling our server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Want to take the first steps for running your Laravel app in the Cloud? <a href=\"https:\/\/signup.upcloud.com\/\">Try UpCloud<\/a> now and explore a set of Cloud services optimized for your Laravel deployment.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQs<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>How do I install Laravel on an Ubuntu server?<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">You can use Composer or the Laravel installer package to install Laravel on Ubuntu. Ensure all dependencies like PHP are installed. You can follow the steps outlined in the guide.<\/p>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li>What is the best way to deploy a Laravel app?<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Using a cloud server like UpCloud\u2019s fast cloud servers that are optimized for running Laravel applications. Upload your files, configure a web server, and set up the database using Laravel Artisan.<\/p>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>How can I scale a Laravel app on UpCloud?<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Implement load balancing and vertical scaling on UpCloud. Optimize app performance by caching and using queues.<\/p>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li>What tools can I use for Laravel deployment?<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Tools like SSH, Git, and deployment managers like Envoyer can simplify deployment.<\/p>\n","protected":false},"author":85,"featured_media":49067,"comment_status":"open","ping_status":"closed","template":"","community-category":[250],"class_list":["post-1912","tutorial","type-tutorial","status-publish","has-post-thumbnail","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/tutorial\/1912","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/tutorial"}],"about":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/types\/tutorial"}],"author":[{"embeddable":true,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/users\/85"}],"replies":[{"embeddable":true,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/comments?post=1912"}],"version-history":[{"count":0,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/tutorial\/1912\/revisions"}],"wp:attachment":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/media?parent=1912"}],"wp:term":[{"taxonomy":"community-category","embeddable":true,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/community-category?post=1912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}