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
mysql_secure_installation

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

标签: none

已有 3 条评论

  1. 大佬,你的域名要到期了,是不是该续上5年了?

    1. 谢谢,我知道。一般一年一续,没有这么豪。

  2. 哈哈,又是技术文。

添加新评论