Originally published October 31, 2017. Updated September 10, 2026 to reflect current Laravel and Ubuntu versions.
Introduction
This guide covers how to install Laravel on a VestaCP account, using Nginx and PHP-FPM.
One note before starting: this guide’s original version targeted Laravel 5.5 and Ubuntu 16.04, both of which are long past end-of-support. Laravel 5.5 reached end-of-life years ago, and Ubuntu 16.04 no longer receives security updates. The steps below still work conceptually on a current setup, but check Laravel’s current PHP version requirements for whichever Laravel version you’re actually installing, since requirements change between major versions.
Implementation
I. Prerequisites
- A VestaCP server with Nginx
- PHP 8.1+ (or whatever your target Laravel version requires — check current docs)
- Root/SSH access to the server
II. How Laravel Runs Under Nginx
Laravel’s actual application code lives in a public subfolder, not the project root. Nginx needs to point directly at that public folder, and all requests that aren’t real files get routed through index.php — Laravel’s front controller, which handles routing internally.

This is why simply pointing your domain at the project’s root folder doesn’t work — the site won’t load correctly until Nginx’s document root is updated to the public subfolder, covered in Step VI.
III. Install Required PHP Extensions
Laravel needs several PHP extensions that aren’t always installed by default. The original guide skipped this step entirely — install them first:
apt-get install php-xml php-mbstring php-tokenizer php-curl php-pdo php-bcmath -y
Adjust package names to include your specific PHP version if your system uses versioned packages (e.g.,
php8.1-xmlinstead ofphp-xml).
IV. Install Composer
The original guide used apt-get install composer, but Ubuntu’s repository version is often outdated. Install it using the official method instead:
curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer
V. Install the Laravel Installer
composer global require "laravel/installer" export PATH=$PATH:$HOME/.config/composer/vendor/bin
If you’re running these commands as a specific user (like
adminon VestaCP, not root), make sure$HOMEresolves to that user’s actual home directory, not root’s — otherwise the installer won’t be found on$PATHafterward.
VI. Create the Laravel Project
Navigate to your domain’s document root:
cd /home/admin/web/domain.com/public_html/
Create a new Laravel project:
laravel new blog
Alternatively,
composer create-project laravel/laravel blogworks the same way and is the more commonly recommended method for current Laravel versions.
VII. Set Ownership and Permissions
chown -R admin: blog cd blog chmod 775 storage chmod 775 bootstrap/cache
Note: The original instructions had a typo —
storgeinstead ofstorage— which would fail with “No such file or directory” since that folder doesn’t exist under that name.
VIII. Point Nginx at the public Folder
Edit the domain’s Nginx config:
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;
Add Laravel’s front-controller routing rule inside the relevant location / block:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
IX. Verify and Restart Nginx
nginx -t
If the syntax check passes:
/etc/init.d/nginx restart
Visit http://domain.com/ to confirm the Laravel welcome page loads.
X. Optional: Add Redis as a Cache Backend
apt-get install php-redis
Enable the extension in php.ini:
extension=redis.so
Note: The original guide’s line had a trailing semicolon (
extension=redis.so;), which isn’t validphp.inisyntax — a semicolon at the start of a line marks a comment, but appending one after a real directive can cause it to be misread. Leave it off.
Restart both services — using your server’s actual installed PHP-FPM version, not a hardcoded one:
/etc/init.d/nginx restart /etc/init.d/php8.1-fpm restart
Check your actual PHP-FPM service name first with
systemctl list-units | grep php-fpmif unsure.
XI. Conclusion
Installing Laravel on VestaCP comes down to setting up Composer correctly, installing the PHP extensions Laravel actually needs, creating the project, fixing folder permissions (watch for the storage typo), and pointing Nginx at the public subfolder rather than the project root. With that done, Laravel’s front controller handles the rest of the routing.
Frequently Asked Questions
Why does my site show a blank page or 403 error after installation? This is almost always the Nginx document root still pointing at the project root instead of blog/public — double-check Step VIII.
Do I need Redis, or is it optional? Optional — Laravel works with file-based caching by default. Redis is worth adding for better performance under real traffic, but isn’t required to get started.
What if laravel command isn’t found after installation? Confirm the export PATH line in Step V actually applied to your current shell session, and that it points to the correct user’s home directory.
Related Articles
How to add Proxy pass rule to access PHPMyAdmin without port number in URL -Plesk
How to Install phpMyAdmin on Ubuntu
Talk to our experts.
Looking for the right technology solution for your business? Our team of experts can help you with development, cloud, DevOps, design, and a wide range of other technology needs. Get in touch with our team here.