Deploy WordPress on Ubuntu VPS (LEMP + FastCGI Micro-Cache + SSL)
Host WordPress on Ubuntu VPS using high-performance LEMP stack, MariaDB, PHP 8.3-FPM, Nginx FastCGI micro-caching, and SSL.
Goal
Deploy a high-speed WordPress website on an Ubuntu VPS capable of handling heavy traffic spikes using Nginx FastCGI micro-caching, PHP 8.3-FPM, and MariaDB.
Execute database setup queries:
```sql
CREATE DATABASE wp_database DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'StrongSecretPassword123!';
GRANT ALL ON wp_database.* TO 'wp_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
```# Set correct ownership for uploads and updates
sudo chown -R www-data:www-data /var/www/wordpress
sudo find /var/www/wordpress/ -type d -exec chmod 755 {} \;
sudo find /var/www/wordpress/ -type f -exec chmod 644 {} \;
``````nginx
# Define cache bypass logic based on cookies and request methods
map $http_cookie $skip_cache {
default 0;
~*comment_author 1;
~*wordpress_logged_in 1;
~*woocommerce_items_in_cart 1;
}
server {
listen 80;
listen [::]:80;
server_name wp.example.com;
root /var/www/wordpress;
index index.php index.html;
client_max_body_size 100M;
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;
# Bypass cache for POST requests or logged-in users
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# Cache static media files
location ~* \.(jpg|jpeg|png|gif|ico|css|js|webp|svg|woff2?)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
access_log off;
}
# Block access to sensitive files
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
}
```
Enable site and obtain SSL:
```bash
sudo ln -s /etc/nginx/sites-available/wp.example.com.conf /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d wp.example.com
```Verification
Open https://wp.example.com in your browser to complete the 5-minute WordPress installation wizard.
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.
Setup Cloudflare Origin CA SSL & Full (Strict) Mode on Nginx
Step-by-step setup of 15-year Cloudflare Origin CA certificates on Nginx, enabling Full (Strict) SSL encryption, and locking down UFW firewall to Cloudflare IPs.