⚙️ How do I set up Nginx for my website

Questions and discussions about VPS plans, Linux setup, WordPress, Nginx, NAT and VPS configuration in Bulgaria.
rychy
Site Admin
Мнения: 132
Регистриран на: Вто Окт 20, 2026 10:45 am

⚙️ How do I set up Nginx for my website

Мнение от rychy »

🇧🇬 Прочети на български

Nginx is a fast and lightweight web server. Here is how to configure it for your website:

Installation

apt update && apt install -y nginx

systemctl enable nginx

systemctl start nginx

Basic configuration

Create the file /etc/nginx/sites-available/my-site:

server {

listen 80;

server_name my-domain.com www.my-domain.com;

root /var/www/my-site;

index index.html index.php;

location / {

try_files $uri $uri/ /index.html;

}

}

Enable the site

ln -s /etc/nginx/sites-available/my-site /etc/nginx/sites-enabled/

nginx -t

systemctl reload nginx

SSL with Let's Encrypt

apt install certbot python3-certbot-nginx

certbot --nginx -d my-domain.com

Useful commands

nginx -t # test the configuration

systemctl reload nginx # reload without a restart

systemctl restart nginx # full restart

tail -f /var/log/nginx/error.log # logs

Any questions? Write here!