How to install Laravel on a Cloud VPS
Updated 7/18/2026
A production-ready Laravel environment with PHP, Composer, a database and a web server configured, so you can deploy your app immediately.
Self-hosting your development tools keeps code and project data inside your infrastructure, and the cost does not grow with the number of users.
One-click install on cloudlinux.ro
The fastest way: Laravel installs automatically at the first boot of a new server.
- Create a Cloud VPS from the control panel.
- In the configuration step, pick Laravel from the app catalog.
- Start the server. The install runs in the background for a few minutes and its status shows on the server page.
- Access details and generated passwords are saved on the server in
/root/app-credentials.txt.
Manual install on any Ubuntu server
If you prefer doing it yourself, below is the exact script our automatic install runs. Execute it as root on a fresh Ubuntu server (24.04 recommended). It stops at the first error, and when it finishes you will find the access details in /root/app-credentials.txt.
export DEBIAN_FRONTEND=noninteractive
apt-get update -y
apt-get install -y nginx mysql-server unzip git curl \
php8.3-fpm php8.3-cli php8.3-mysql php8.3-sqlite3 php8.3-xml php8.3-mbstring \
php8.3-curl php8.3-zip php8.3-gd php8.3-bcmath php8.3-intl
curl -fsSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt-get install -y nodejs
DB_PASS=$(openssl rand -base64 24 | tr -dc 'A-Za-z0-9' | cut -c1-20)
mysql -e "CREATE DATABASE laravel; CREATE USER 'laravel'@'localhost' IDENTIFIED BY '${DB_PASS}'; GRANT ALL PRIVILEGES ON laravel.* TO 'laravel'@'localhost'; FLUSH PRIVILEGES;"
export COMPOSER_ALLOW_SUPERUSER=1
composer create-project laravel/laravel /var/www/laravel --no-interaction --prefer-dist
cd /var/www/laravel
sed -i "s|^DB_CONNECTION=.*|DB_CONNECTION=mysql|" .env
sed -i "s|^# DB_HOST=.*|DB_HOST=127.0.0.1|" .env
sed -i "s|^# DB_PORT=.*|DB_PORT=3306|" .env
sed -i "s|^# DB_DATABASE=.*|DB_DATABASE=laravel|" .env
sed -i "s|^# DB_USERNAME=.*|DB_USERNAME=laravel|" .env
sed -i "s|^# DB_PASSWORD=.*|DB_PASSWORD=${DB_PASS}|" .env
php artisan migrate --force
chown -R www-data:www-data /var/www/laravel
cat > /etc/nginx/sites-available/laravel <<'NGINX'
server {
listen 80 default_server;
root /var/www/laravel/public;
index index.php;
server_name _;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}
}
NGINX
rm -f /etc/nginx/sites-enabled/default
ln -sf /etc/nginx/sites-available/laravel /etc/nginx/sites-enabled/laravel
systemctl enable --now php8.3-fpm nginx mysql
systemctl reload nginx
IP=$(hostname -I | awk '{print $1}')
printf 'Laravel: http://%s\nProiect: /var/www/laravel\nMySQL: baza laravel, utilizator laravel, parola %s (deja configurate in .env)\nComposer si Node.js 22 sunt instalate global.\n' "$IP" "$DB_PASS" > /root/app-credentials.txt
You can also save this script as a recipe in your account and reuse it on any new server.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
How to install WordPress on a Cloud VPS
Complete WordPress guide: one-click install on cloudlinux.ro or manual setup on any Ubuntu server, step by step.
Updated 7/18/2026ApplicationsHow to install ProjectSend on a Cloud VPS
Complete ProjectSend guide: one-click install on cloudlinux.ro or manual setup on any Ubuntu server, step by step.
Updated 7/18/2026ApplicationsHow to install Prometheus + Grafana on a Cloud VPS
Complete Prometheus + Grafana guide: one-click install on cloudlinux.ro or manual setup on any Ubuntu server, step by step.
Updated 7/18/2026