Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Laravel web templates for VestaCP

I'm not using this or VestaCP anymore, so I can't confirm if still working or not.

I've made a new web template to make Laravel work easily on VestaCP, and so I wouldn't have to change my Laravel installation, if I ever wanted to deploy it elsewhere.

Each file should be put in /usr/local/vesta/data/templates/web/apache2

Then, when you edit your domain/site, you can change the web template to Laravel and just upload your whole project into public_html

<VirtualHost %ip%:%web_ssl_port%>
ServerName %domain_idn%
%alias_string%
ServerAdmin %email%
DocumentRoot %sdocroot%/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 %sdocroot%>
AllowOverride All
SSLRequireSSL
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>
SSLEngine on
SSLVerifyClient none
SSLCertificateFile %ssl_crt%
SSLCertificateKeyFile %ssl_key%
%ssl_ca_str%SSLCertificateChainFile %ssl_ca%
<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/s%web_system%.%domain%.conf*
</VirtualHost>
<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>
@blathrop

This comment has been minimized.

Copy link

commented Aug 28, 2017

This worked for me. Huge help, thanks!

@huszerldani

This comment has been minimized.

Copy link

commented Jan 4, 2019

This was very useful for me. Thank you!

@armavion

This comment has been minimized.

Copy link

commented Mar 15, 2019

Thanks a lot! Works great.

@anelad

This comment has been minimized.

Copy link

commented Apr 10, 2019

Is it still working and works for Symfony too?

@enbermudas

This comment has been minimized.

Copy link

commented Jun 3, 2019

It throws the next error:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at info@iberoseguridad.eu to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
@edica

This comment has been minimized.

Copy link

commented Jul 29, 2019

Work when renew Let's Encrypt?

@lao9s

This comment has been minimized.

Copy link

commented Aug 10, 2019

Not working when i use https://laravel-excel.com/
Error:
file_exists(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/admin/web/example.com/public_html:/home/admin/tmp)

@peterbrinck

This comment has been minimized.

Copy link
Owner Author

commented Aug 10, 2019

@edica Yes, the template doesn't have anything to do with Let's Encrypt

@lao9s In both templates, there's a line php_admin_value open_basedir %docroot%:%home%/%user%/tmp
Change it to php_admin_value open_basedir %docroot%:%home%/%user%/tmp:/tmp and it should work

@anelad I'm not using Vesta anymore, so I can't confirm or deny if it's still working, but I would assume it still works, as I don't think Vesta has changed it's template structue

@enbermudas I need more information before I can help you

@lao9s

This comment has been minimized.

Copy link

commented Aug 10, 2019

@peterbrinck thank you

@anburocky3

This comment has been minimized.

Copy link

commented Sep 16, 2019

It is not working for CentOS powered VESTACP?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.