Run a Laravel application
Build a Laravel application locally, upload it and add the web.config that routes requests to the public folder.
Laravel is a modern PHP framework that runs well on our hosting. You prepare the application on your computer, upload it into /wwwroot and add a web.config that sends requests to Laravel's public folder.
Important
You cannot run Composer commands on our server. Run all necessary Composer commands locally on your computer before you upload the application.
Build the application locally
You need:
- PHP 8.3 or newer — php.net
- Composer, the PHP dependency manager — getcomposer.org
Check Composer
Install PHP and Composer and make sure both work. You can verify the Composer installation with:
composer -VInstall the Laravel installer
composer global require laravel/installerCreate a project
Create a new example application:
composer create-project laravel/laravel example-appRun it locally
Switch to the
example-appdirectory and start the application:cd example-app php artisan serveOpen
http://127.0.0.1:8000/in your browser to see the running application.
If you already have your own Laravel application, skip this part.
Select the PHP version of the website
In the Control Panel go to Websites, select your website and choose Scripting. In the PHP card select the PHP Version your application needs and click Save. See Run PHP on your website.
Deploy the application
All Laravel files must be located in /wwwroot, the root directory of your website. A Laravel project contains thousands of small files, so the deployment method matters:
| Method | Speed |
|---|---|
| Web Deploy from the command line | Fastest |
| ZIP archive uploaded and extracted on the server | Fast |
| FTP / SFTP with FileZilla | Slower |
With FileZilla, open the local folder of your Laravel application in the left panel, select all files and folders and drag them into wwwroot in the right panel.
Add the web.config
For Laravel URL routing to work you also have to upload this web.config into /wwwroot:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<!-- Default document configuration -->
<defaultDocument>
<files>
<clear />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<!-- Rewrite everything to /public folder -->
<rule name="Laravel to public">
<match url="(.*)" ignoreCase="false" />
<!-- Rewrite request to the public folder -->
<action type="Rewrite" url="public/{R:1}" />
</rule>
<!-- Handle Laravel routes inside /public folder -->
<rule name="Laravel Routes" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<!-- Skip if requested file or directory physically exists -->
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<!-- Send all other requests to Laravel front controller -->
<action type="Rewrite" url="public/index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
The first rule rewrites every request into the public folder. The second rule sends everything that is not an existing file or directory to Laravel's front controller, public/index.php.
Your Laravel application is now deployed. Open the address of your website to see it.