DevOps & Deployment
devopsdeploymentRecipeBeginner
Deploy Native PHP Web Apps on Ubuntu VPS (PHP-FPM + Nginx + SSL)
Deploy and host native PHP 8.3/8.4 web applications on Ubuntu VPS with PHP-FPM, OPcache performance tuning, Nginx FastCGI socket, and SSL.
Verified: 2026-10-01
Tested on:php 8.3, nginx 1.26
Platforms:
linuxall
#php#php-fpm#vps#nginx#lemp#deployment
Goal
Deploy a native PHP web application on an Ubuntu VPS using PHP 8.3 FastCGI Process Manager (PHP-FPM) and Nginx with OPcache enabled.
```ini
upload_max_filesize = 50M
post_max_size = 50M
memory_limit = 256M
max_execution_time = 60
expose_php = Off
; Enable Zend OPcache for pre-compiled bytecode caching
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.validate_timestamps=0
```
Restart PHP-FPM:
```bash
sudo systemctl restart php8.3-fpm
``````nginx
server {
listen 80;
listen [::]:80;
server_name php.example.com;
root /var/www/php-app;
index index.php index.html;
client_max_body_size 50M;
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;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
```
Enable site and obtain SSL:
```bash
sudo ln -s /etc/nginx/sites-available/php.example.com.conf /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d php.example.com
```Deploy Go & Gin API on Ubuntu VPS (Systemd + Nginx + SSL)
Deploy a high-performance Go Gin REST API on Ubuntu VPS using compiled standalone binaries, systemd service management, Nginx reverse proxy, and SSL.
Deploy Laravel on Ubuntu VPS (LEMP + Queue Worker + Cron + SSL)
Production guide for hosting Laravel 11/12 on Ubuntu VPS with PHP 8.3-FPM, Nginx public root, Artisan optimization, systemd queue workers, and cron scheduler.