Page 1 of 1

Laravel in folder

Posted: Tue Mar 28, 2017 2:46 pm
by dev7
I have laravel in a folder and I keep getting the 403 forbidden error. To access the site I have to go to mysite.com/laravel/public. I want it to work as mysite.com/laravel

Is this possible? If so can someone tell me the best way how please.

Thanks in advance.

Re: Laravel in folder

Posted: Wed Mar 29, 2017 11:44 am
by skurudo

Re: Laravel in folder

Posted: Tue Apr 11, 2017 11:48 am
by dev7
My main page is loading correctly at mysite.com/folder & the login auth works but it redirects me to mysite.com. if i manually navigate to mysite.com/folder it is logged in correctly but all of the routes are messed up.

mysite.com/folder/page gives me a 500 internal server error and mysite.com/page is working

Re: Laravel in folder

Posted: Tue Apr 11, 2017 12:33 pm
by peterbrinck
You can create a new Apache/Web template, call it Laravel, that has the correct configuration for a Laravel app.
So the document root would have to point to the /public folder in your Laravel app.

Here's my web template for Laravel apps (/usr/local/vesta/data/templates/web/apache2):

Code: Select all

<VirtualHost %ip%:%web_port%>

    ServerName %domain_idn%
    %alias_string%
    ServerAdmin %email%
    DocumentRoot %docroot%/public
    ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
    Alias /vstats/ %home%/%user%/web/%domain%/stats/
    Alias /error/ %home%/%user%/web/%domain%/document_errors/
    #SuexecUserGroup %user% %group%
    CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
    CustomLog /var/log/%web_system%/domains/%domain%.log combined
    ErrorLog /var/log/%web_system%/domains/%domain%.error.log
    <Directory %docroot%>
        AllowOverride All
        Options +Includes -Indexes +ExecCGI
        php_admin_value open_basedir %docroot%:%home%/%user%/tmp
        php_admin_value upload_tmp_dir %home%/%user%/tmp
        php_admin_value session.save_path %home%/%user%/tmp
    </Directory>
    <Directory %home%/%user%/web/%domain%/stats>
        AllowOverride All
    </Directory>

    <IfModule mod_ruid2.c>
        RMode config
        RUidGid %user% %group%
        RGroups www-data
    </IfModule>
    <IfModule itk.c>
        AssignUserID %user% %group%
    </IfModule>

    IncludeOptional %home%/%user%/conf/web/%web_system%.%domain%.conf*

</VirtualHost>


The template could be done in another way, but I found it easiest to just leave the public_html folder and put my Laravel app inside.

Then, when you have created the domain for the Laravel app in Vesta, you can change the Web Template to Laravel, and the conf files will, all by it self, match your Laravel config template.