Configuring Nginx for a Website on VDS

VDS / VPS Servers · 20.02.2025
Configuring Nginx for a Website on VDS

Nginx Virtual Host Configuration

server {
    listen 80;
    server_name yourdomain.com www.yourdomain.com;
    root /var/www/yourdomain.com;
    index index.php index.html;
    location / { try_files $uri $uri/ /index.php?$args; }
    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
        include fastcgi_params;
    }
}

Enable the config:

ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
← Back to Knowledge Base Ask Support