Laravel VPS Requirements
Laravel 11.x requires PHP 8.2+, extensions: BCMath, Ctype, cURL, DOM, Fileinfo, JSON, Mbstring, OpenSSL, PDO, Tokenizer, XML. Also needed: Composer, MySQL/MariaDB or PostgreSQL.
Install Dependencies
sudo apt update && sudo apt install -y php8.2-fpm php8.2-mysql \
php8.2-mbstring php8.2-xml php8.2-curl php8.2-zip php8.2-bcmath \
nginx mysql-server git
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composerInstall Laravel
cd /var/www && composer create-project laravel/laravel myapp
cd myapp && chmod -R 775 storage bootstrap/cache
chown -R www-data:www-data .
cp .env.example .env && php artisan key:generateNginx vhost
server {
listen 80;
server_name yourdomain.com;
root /var/www/myapp/public;
index index.php;
location / { try_files $uri $uri/ /index.php?$query_string; }
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
}Migrations and Optimization
php artisan migrate --force
php artisan optimizeProduction optimization:
php artisan optimize caches config, routes and views — speeds up responses by 30–50%.