Installing Nginx on Ubuntu VPS
SSH into your Netherlands Linux VPS and run:
apt update
apt install nginx -y
systemctl enable nginx
systemctl start nginx
Verify Nginx is running: systemctl status nginx. Open your VPS IP in a browser — you should see the Nginx welcome page.
Configure UFW Firewall
# Allow HTTP and HTTPS
ufw allow 'Nginx Full'
ufw allow OpenSSH
ufw enable
ufw status
Create a Server Block (Virtual Host)
Server blocks in Nginx are equivalent to Apache's virtual hosts — they let you serve multiple domains from one VPS. Create a config file for your domain:
nano /etc/nginx/sites-available/yourdomain.com
Paste this configuration:
server {
listen 80;
listen [::]:80;
server_name yourdomain.com www.yourdomain.com;
root /var/www/yourdomain.com;
index index.html index.php;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
}
}
Enable the site and test:
ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/
nginx -t
systemctl reload nginx
Enable HTTPS with Let's Encrypt
apt install certbot python3-certbot-nginx -y
certbot --nginx -d yourdomain.com -d www.yourdomain.com
Certbot automatically modifies your Nginx config to redirect HTTP to HTTPS and installs the free SSL certificate. Certificates auto-renew every 90 days via a systemd timer.
Configure PHP-FPM with Nginx
apt install php8.1-fpm php8.1-mysql php8.1-curl php8.1-gd php8.1-mbstring -y
systemctl enable php8.1-fpm
systemctl start php8.1-fpm
Nginx + PHP-FPM is the recommended stack for WordPress on VPS — faster and more memory-efficient than Apache + mod_php.
Performance Optimisation
# Enable Gzip compression in /etc/nginx/nginx.conf
gzip on;
gzip_types text/plain text/css application/json application/javascript;
gzip_min_length 1024;
# Enable browser caching
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
}
Get Your Linux VPS in Amsterdam
Install Nginx in minutes — from $3/month with NVMe SSD
Deploy Netherlands VPS Now