Laravel 10 starter app using breeze on live server

Created at 12-Mar-2024 , By samar

In this tutorial, we will learn about how to create a Laravel 10 project using Breeze starter kit on live server step by step. To create the Laravel project you have to first login to your server using SSH command (ssh setz7b4duzpf@265.66.90.446) and after entering command you have to enter the password in terminal. After successful login move to public_html directory using cd public_html command.

1. Create Laravel project using composer create-project laravel/laravel . command. This command will create laravel project in current directory (public_html).

composer create-project laravel/laravel .

2. Add configuration details (DB_DATABASE, DB_USERNAME, DB_PASSWORD, APP_URL, ASSET_URL) to .env file which exists in root directory of project. Please run cp .env.example .env command if you did not found the .env file and enter the required details.

APP_URL=http://domain.com

DB_DATABASE=database_name
DB_USERNAME=database_username
DB_PASSWORD=database_password

3. Add laravel Breeze starter package using composer require command

composer require laravel/breeze --dev

4. Run php artisan breeze:install command after composer require laravel/breeze --dev.

After installing the Laravel Breeze package, run the following command. This will create authentication views, routes, controllers, and other resources for your application. When prompted, choose the first option (Blade) if you want to use Blade templates. You can select other options based on your requirements.

php artisan breeze:install

5. Run migration command and npm install and npm run build command to create tables in database, installing node packages and bundle the front-end assets, such as JavaScript and CSS files, into a production-ready format respectively.

php artisan migrate

npm install

npm run build

6. Create a .htaccess file in the root directory of your project and copy/paste below code in it.

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization MemberHeader
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    RewriteCond %{REQUEST_URI} !^/public/
    RewriteRule ^(.*)$ /public/$1 [L,QSA]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Now visit home page of your website. You will we able to visit your login and register page of website.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.