Laravel 5: Startup – Document Root Setup

DocRoot Setup

It is necessary to point main www address to Laravel’s /public folder, taking all the rest of Laravel framework files out of realm of web access.

DirectAdmin

You must have access to: Custom HTTPD Configurations
Once inside, click on: domain you have Laravel on.

option 1:

use available tokens

option 2:
you can try to add custom <Virtualhost> … something like:

… and add also similar code for SSL

option 3:

If you have access to server (Apache) itself, just go to

… and add code from option 2 directly to httpd-vhosts.conf file.

More can be found in DirectAdmin docs.

cPanel

option #1:
If you are on your own server and have access to httpd.conf file inside of /apache/conf/extra directory, you can change DocumentRoot in httpd.conf.
Read some more here in cPanel forums.

option #2:

If you cannot follow option 1, then do it differently, using cPanel interface.

You would need 2 domains:

  1. your main domain, you want your web page to show under
  2. some simple domain you dock cPanel on – it will be your main domain (as it is called in cPanel) – in reality, it will not.

Now, follow these steps:

  1. setup your cPanel with that docking domain as main.
  2. go to addon domains and create addon domain using your main domain (not docking one)
  3. when creating docking domain, set Document Root to something like:You may go to: Redirects and point your “docking” domain to Laravel Document Root

    note:

    At the end, there is a “public” folder.
    This is the same folder, you have all your public Laravel documents stored in.
    This is the ONLY folder, you should expose to web access.
    It is assumed, you install your Laravel to:

    Of course, if you intend to use your server for other domains, you may install Laravel to:

    Then, you should setup Document Root to:

    Some say, you should also redirect your Laravel domain to its http url in cPanel Redirects manager.

option 3:

If you have access to server (Apache) itself, just go to

… and add code from option 2 directly to httpd-vhosts.conf file.

Webmin/Virtualmin

option 1: (probably the easiest)

Select Virtualmin section.
Go to: Server Configuration / Website Options.
Chance setting in: Website documents sub-directory to public_html/public

option 2:

If you have access to server (Apache) itself, just go to

… and add code from option 2 directly to httpd-vhosts.conf file.

Localhost: XAMPP/WAMP

Look for:

Then, add code something like this code.

Then you should restart your WAMP/XAMPP.