Laravel installation on VestaCP account
L1aravel 5.5 installation on VestaCP domain
Date posted: 31-10-2017
Assumptions:-
We assume you have the following server setup
- VestaCP
- Ubuntu 16.04
- Nginx
- PHP >= 7.0.0
- PHP modules OpenSSL, xml, PDO, Tokenizer and mbstring
Installing Laravel
Install composer
apt-get install composer
Download the Laravel installer using Composer:
composer global require "laravel/installer"
Export laravel binary to env PATH, so that you can access it via commandline
export PATH=$PATH:$HOME/.config/composer/vendor/bin
Change your directory to domain’s document root public_html
cd /home/admin/web/domain.com/public_html/
Install Laravel with all of Laravel’s dependencies, this command will create a folder
called blog with necessary files.
laravel new blog
Apply ownership to folders and files
chown -R admin: blog
Apply write permission to storage & bootstrap/cache folders
cd blog
chmod 775 storge
chmod 775 bootstrap/cache
Change domain document root to public folder in nginx.conf
vi /home/admin/conf/web/nginx.conf
Find
root /home/admin/web/domain.com/public_html;
Change to
root /home/admin/web/domain.com/public_html/blog/public;
If you are using Nginx, the following directive in your site configuration will direct all requests to the index.php
front controller:
location / { try_files $uri $uri/ /index.php?$query_string; }
Verify nginx configuration
nginx -t
Restart Nginx service
/etc/init.d/nginx restart
Verify your domain http://domain.com/
In case you need to use redis as backend cache. You need to install it first.
apt-get install php-redis
Enable redis extension in php.ini
extension=redis.so;
Restart nginx & php-fpm services
/etc/init.d/nginx restart
/etc/init.d/php7.1-fpm restart