sudo dd if=/dev/zero of=/swapfile bs=1M count=2048 ```

sudo fallocate -l 2G /swapfile

sudo chmod 600 /swapfile

sudo mkswap /swapfile

sudo swapon /swapfile

echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

AI写代码

bash

设置2G虚拟内存

sudo apt update -y && sudo apt upgrade -y

sudo apt install nginx

AI写代码

bash

更新软件并安装nginx

vim /etc/nginx/sites-available/yourweb.com

AI写代码

bash

配置nginx文件

server {

listen 80;

server_name your_domain.com www.your_domain.com;

root /var/www/html/yourweb;

index index.html index.htm;

location / {

try_files $uri $uri/ =404;

}

}

AI写代码

bash

编辑文件后保存退出

sudo apt install zip

cd /var/www/unzip_202506271910_dist/dist

sudo mv * /var/www/html

cd /var/www/html

sudo chmod -R 775 /var/www/html

AI写代码

bash

把你上传的前端文件压缩包解压移动到/var/www/html里

sudo apt-get install certbot python3-certbot-nginx

sudo add-apt-repository ppa:certbot/certbot

AI写代码

bash

安装配置自动配置ssl证书软件

sudo certbot --nginx -d yourweb.com

AI写代码

bash

申请证书自动配置ssl到nginx

————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/stupu/article/details/148959967