Use this when deploying your app to shared hosting where You can't directly access apache virtual hosts.
- Go to Your public_html dir (the main dir of your domain) - hosting provider usualy puts here sth like
default.php
orindex.php
- delete this and any other files that are there. - Clone Your repository directly to the directory:
git clone git@github.com:Vendor/ProjectName.git .
(the dot at the end specifies that You want files to be downloaded directly to the dir You are currently in)
- Create new file
server.php
with content:
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
require_once __DIR__.'/public/index.php';
- Create .htaccess file with content:
Options +FollowSymLinks -Indexes
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} www.jaksmakowalo.pl
RewriteRule (.*) https://jaksmakowalo.pl/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_URI} !(\.ico|\.css|\.js|\.png|\.gif|robots\.txt|\.eot|\.svg|\.ttf|\.woff|\.woff2|\.otf|\.pdf)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(login|uploads|assets|css|js|images|ca|favicons|fonts|)/(.*)$ public/$1/$2 [L,NC]
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
RewriteRule ^$ public/index.php [L]
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
- Check if You have composer installed:
composer -v
(version 2 is prefered)
- if non (or version 1.x is installed) you have to install newer version: Official composer install instruction
- Depending on how You installed composer you may use
composer -v
orphp composer.phar -v
to check version again ;)
- Copy
.env.example
to.env
:cp .env.example
.env
and configure Your project (db connection, project name other connections) - Run
composer install
orphp composer.phar install
php artisan key:generate
- Migration:
php artisan migrate
- Seeders
php artisan db:seed
- Now we need to install node.js (npm) - You may skip this if
npm -v
returns npm version
- Install nvm: https://github.com/nvm-sh/nvm
nvm install 16
- Run
npm run build
Your project should be up and running :D