Hi all,
How to install Laravel on DirectAdmin server.
What is Laravel?
Laravel is an open-source PHP framework used to build websites and apps. It contains all the necessary components and features to help web developers create a website using the PHP scripting language. It is important to note that Laravel isn’t the only framework available to PHP developers. In fact, other popular PHP frameworks include Symfony, CodeIgniter and Yii (just to name a few). And if we venture outside the PHP zone, there’s even more frameworks available, such as Rails which is based on the Ruby language, .NET which uses C#, or Sails.js, a Javascript framework.
Requirements:
step 1. SSH into your server and update your system and install the nessesery packages
step 2. Install Composer
Step 3. Prepare to install Laravel
To install Laravel project, you need to make sure that the public_html folder is empty. To empty this folder excecute the following command
Step 4. cd into your domain
*NOTE DO NOT DO THIS AS ROOT, BUT AS THE USER ITSELF*
Step 5. Install Laravel
This will be done using the composer command, important that you keep the . at the end.
Because Laravel uses a folder called "public", this has to be set as the default folder to view.
Go to step 6b if you use a subdomain to install Laravel in
Step 6a. Change the document root to /public
1. Login as an Admin into your server.
2. Go to Server Manager --> Custom HTTPD Configurations
3. Look for the domain you want to change the docroot for.
4. Click on httpd.conf
5. Click up right on CUSTOMIZE
6. under "httpd.conf customization for LARAVEL_DOMAIN" add the following line:
Step 6b. Change the document root to /public for a subdomain
1. Login as the User into your server.
2. Go to Account Manager --> Subdomain Management
3. Where you see Docroot click on the pencil on the right of it and add
Now you should be able to see the Laravel welcome page when you visit your domain.
Note that it can take a small amount of time to update your HTTPD.conf so you will not see the change the next second.
How to install Laravel on DirectAdmin server.
What is Laravel?
Laravel is an open-source PHP framework used to build websites and apps. It contains all the necessary components and features to help web developers create a website using the PHP scripting language. It is important to note that Laravel isn’t the only framework available to PHP developers. In fact, other popular PHP frameworks include Symfony, CodeIgniter and Yii (just to name a few). And if we venture outside the PHP zone, there’s even more frameworks available, such as Rails which is based on the Ruby language, .NET which uses C#, or Sails.js, a Javascript framework.
Requirements:
- PHP 7 (or higher)
- OpenSSL, Mbstring, PDO, Tokenizer, PHP and XML Extensions
- Apache or Nginx
step 1. SSH into your server and update your system and install the nessesery packages
yum update
yum install git curl
step 2. Install Composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
Step 3. Prepare to install Laravel
To install Laravel project, you need to make sure that the public_html folder is empty. To empty this folder excecute the following command
Where you have to replace "USERNAME" with the Directadmin username of your user, and "LARAVEL_DOMAIN" with the domain you would like to install Laravel on.rm -rf /home/USERNAME/domains/LARAVEL_DOMAIN/public_html/*
Step 4. cd into your domain
*NOTE DO NOT DO THIS AS ROOT, BUT AS THE USER ITSELF*
Where you have to replace "USERNAME" with the Directadmin username of your user, and "LARAVEL_DOMAIN" with the domain you would like to install Laravel on.cd /home/USERNAME/domains/LARAVEL_DOMAIN/public_html/
Step 5. Install Laravel
This will be done using the composer command, important that you keep the . at the end.
composer create-project --prefer-dist laravel/laravel .
Because Laravel uses a folder called "public", this has to be set as the default folder to view.
Go to step 6b if you use a subdomain to install Laravel in
Step 6a. Change the document root to /public
1. Login as an Admin into your server.
2. Go to Server Manager --> Custom HTTPD Configurations
3. Look for the domain you want to change the docroot for.
4. Click on httpd.conf
5. Click up right on CUSTOMIZE
6. under "httpd.conf customization for LARAVEL_DOMAIN" add the following line:
7. click on the SAVE button on the bottom right.|?DOCROOT=`HOME`/domains/`DOMAIN`/public_html/public|
Step 6b. Change the document root to /public for a subdomain
1. Login as the User into your server.
2. Go to Account Manager --> Subdomain Management
3. Where you see Docroot click on the pencil on the right of it and add
4. Click the SAVE button/public
Now you should be able to see the Laravel welcome page when you visit your domain.
Note that it can take a small amount of time to update your HTTPD.conf so you will not see the change the next second.