lemp on debian 11

apt update
apt-get install nginx -y
systemctl start nginx
systemctl enable nginx

nano /etc/nginx/sites-available/your-domain-name.com

server {

  listen 80;
  server_name example.com www.example.com;

  root /var/www/html;
  index index.php index.html index.nginx-debian.html;
  access_log /var/log/nginx/example_access.log;
  error_log /var/log/nginx/example_error.log;

  location / {
    try_files $uri $uri/ /index.php$is_args$args;

  location ~ \.php$ {
    try_files $uri =404;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_pass unix:/run/php/php7.4-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;


ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/example.com

systemctl reload nginx

apt-get install mariadb-server -y
systemctl start mariadb
systemctl enable mariadb

Press Y to Switch to unix_socket authentication.

apt-get install php php-fpm php-curl php-cli php-zip php-mysql php-xml -y

apt install snapd

snap install core
snap refresh core

apt remove certbot
snap install --classic certbot

ln -s /snap/bin/certbot /usr/bin/certbot

certbot --nginx --agree-tos --redirect --email your_email@example.com -d example.com -d www.example.com

nginx 设置nginx.conf server_tokens off