How to run Laravel 8.0 on Directadmin (Centos Linux) | Majid Jalilian Code

by majid
2 years ago
Click to rate this post!
[Total: 1 Average: 5]

Problem: How to Install and configure Laravel (8.0 v) on Directadmin?

Problem 2: Laravel uses public/index.php to run, but Directadmin uses public_html instead of the public! How to solve it?

We are here to solve these problems in our VPS or hosting service.

Firstly, Laravel needs to install composer on your server or hosting. So if you are using VPS, you can install Composer on Linux tutorial here, and if you are using a hosting service, please get in touch with your hosting provider.

You may have two different situations to your Laravel project:

  1. You worked on a project and want to release it on your VPS/Host. (Preferred)
  2. You want to create a project on your VPS/Host. (It’s not a good idea, and we don’t talk about it!)

So we consider you have a ready project and want to release it on your DirectAdmin.

Release Laravel on DirectAdmin – Method #1 change public to public_html:

  1. Upload your codes to your main directory before public_html or use git clone to get your project with command. (Ex: /home/your_user_name/
    Warning: don’t upload your vendor or node_modules.
  2. Use composer install to download and install composer dependencies directory. If you need to run npm in your project, use the command. npm install .
  3. Rename /public directory to /public_html. (if you have public_html, you can move files from public to public_html)
  4. Edit register() in App\Providers\AppServiceProvider to add this code in register() function:
  5. Now open server.php in your main directory, you can see the below code, and you must replace it with new following code:

Warning: if you had a problem loading static images, you could create a symlink with /public name to /public_html. ex:

Method #2: Don’t change anything in Laravel and use the custom httpd config option in DirectAdmin (Manual)

Warning: In this method, your domain must not be listed in DirectAdmin.

Warning: You need apache configuration knowledge to do this.

  1. Create your domain manually in DirectAdmin file manager. ex: /home/your_user_name/
  2. Open ‘ Custom HTTPD Configurations ‘ in your DirectAdmin menu.
  3. On this page, click on your domain’ httpd.conf‘.
  4. Then select customize to add custom config to your DirectAdmin.
  5. You must add custom virtual host code to Custom 2.
See also  Installing composer on CentOS 8.0/7.0, Ubuntu, Redhat and any Linux distribution


You can ask your questions and report problems in review 🙂

Click to rate this post!
[Total: 1 Average: 5]

Leave a Reply

Your email address will not be published. Required fields are marked *