sudo apt install apache2<\/pre>\nOnce, installed start and enable the service.<\/p>\n
sudo systemctl enable apache2 && sudo systemctl start apache2<\/pre>\nCheck if the service is up and running:<\/p>\n
sudo systemctl status apache2<\/pre>\nYou should receive the following output:<\/p>\n
root@host:~# sudo systemctl status apache2\r\n\u25cf apache2.service - The Apache HTTP Server\r\n Loaded: loaded (\/lib\/systemd\/system\/apache2.service; enabled; vendor preset: enabled)\r\n Active: active (running) since Fri 2022-05-06 09:01:22 UTC; 4h 24min ago\r\n Docs: https:\/\/httpd.apache.org\/docs\/2.4\/\r\n Main PID: 658 (apache2)\r\n Tasks: 8 (limit: 4566)\r\n Memory: 19.6M\r\n CPU: 2.320s\r\n CGroup: \/system.slice\/apache2.service\r\n \u251c\u2500 658 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500 681 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500 682 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500 683 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500 684 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500 685 \/usr\/sbin\/apache2 -k start\r\n \u251c\u250013745 \/usr\/sbin\/apache2 -k start\r\n \u2514\u250013746 \/usr\/sbin\/apache2 -k start\r\n\r\nMay 06 17:01:21 host.test.vps systemd[1]: Starting The Apache HTTP Server...\r\nMay 06 17:01:22 host.test.vps systemd[1]: Started The Apache HTTP Server.\r\n<\/pre>\n<\/span>Step 3. Install PHP8.1 with dependencies<\/span><\/h2>\nTo install the PHP8.1 along with extensions execute the following command:<\/p>\n
sudo apt-get install php8.1 php8.1-cli php8.1-common php8.1-imap php8.1-redis php8.1-snmp php8.1-xml php8.1-zip php8.1-mbstring php8.1-curl\r\n<\/pre>\n<\/span>Step 4. Install Composer<\/span><\/h2>\nWe need to install the Composer responsible for installing all the Laravel components.<\/p>\n
curl -sS https:\/\/getcomposer.org\/installer | php -- --install-dir=\/usr\/bin --filename=composer<\/pre>\nCheck the Composer installation:<\/p>\n
composer<\/pre>\nYou should receive the following output:<\/p>\n
root@vps:~# composer\r\nDo not run Composer as root\/super user! See https:\/\/getcomposer.org\/root for details\r\nContinue as root\/super user [yes]? yes\r\n ______\r\n \/ ____\/___ ____ ___ ____ ____ ________ _____\r\n \/ \/ \/ __ \\\/ __ `__ \\\/ __ \\\/ __ \\\/ ___\/ _ \\\/ ___\/\r\n\/ \/___\/ \/_\/ \/ \/ \/ \/ \/ \/ \/_\/ \/ \/_\/ (__ ) __\/ \/\r\n\\____\/\\____\/_\/ \/_\/ \/_\/ .___\/\\____\/____\/\\___\/_\/\r\n \/_\/\r\nComposer version 2.3.5 2022-04-13 16:43:00\r\n\r\nUsage:\r\n command [options] [arguments]\r\n\r\nOptions:\r\n -h, --help Display help for the given command. When no command is given display help for the list command\r\n -q, --quiet Do not output any message\r\n -V, --version Display this application version\r\n --ansi|--no-ansi Force (or disable --no-ansi) ANSI output\r\n -n, --no-interaction Do not ask any interactive question\r\n --profile Display timing and memory usage information\r\n --no-plugins Whether to disable plugins.\r\n --no-scripts Skips the execution of all scripts defined in composer.json file.\r\n -d, --working-dir=WORKING-DIR If specified, use the given directory as working directory.\r\n --no-cache Prevent use of the cache\r\n -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\r\n\r\n<\/pre>\n<\/span>Step 5. Install Laravel<\/span><\/h2>\nGo into the document root of the website and install Laravel with the composer. In this blog post we will use the default apache2 document root:<\/p>\n
cd \/var\/www\/html\/\r\n\r\ncomposer create-project laravel\/laravel \"YOUR APPLICATION NAME\"\r\n<\/pre>\nWe will use test-project<\/b> as the application name. Once the command for creating the application is executed you should receive the following output:<\/p>\nroot@vps:\/var\/www\/html# composer create-project laravel\/laravel test-project\r\nDo not run Composer as root\/super user! See https:\/\/getcomposer.org\/root for details\r\nContinue as root\/super user [yes]? yes\r\nCreating a \"laravel\/laravel\" project at \".\/test-project\"\r\nInfo from https:\/\/repo.packagist.org: #StandWithUkraine\r\nInstalling laravel\/laravel (v9.1.7)\r\n - Downloading laravel\/laravel (v9.1.7)\r\n - Installing laravel\/laravel (v9.1.7): Extracting archive\r\nCreated project in \/var\/www\/html\/test-project\r\n> @php -r \"file_exists('.env') || copy('.env.example', '.env');\"\r\nLoading composer repositories with package information\r\n<\/pre>\nAfter successful installation you should receive the following output:<\/p>\n
Package manifest generated successfully.\r\n78 packages you are using are looking for funding.\r\nUse the `composer fund` command to find out more!\r\n> @php artisan vendor:publish --tag=laravel-assets --ansi --force\r\nNo publishable resources for tag [laravel-assets].\r\nPublishing complete.\r\n> @php artisan key:generate --ansi\r\nApplication key set successfully.\r\n<\/pre>\nGo into the test-project<\/b> directory and set the correct permissions:<\/p>\ncd \/var\/www\/html\/test-project\r\n\r\nchown -R www-data:www-data .\r\n\r\nchmod -R 775 storage\/\r\n<\/pre>\n