vue3 部署 打包命令 nginx配置等
refer: https://cloud.tencent.com/developer/article/2229582
1.使用vue3打包:
npm run build2.scp打包好的dist(整个文件夹)到服务器特定位置(自己确定)
3.配置nginx
例如:(使用ssl)
server {
listen 443 ssl;
server_name www.123.linlin.fun 123.linlin.fun;
charset utf-8;
root /tmp/dist;
index index.html;
ssl_certificate /tmp/123.linlin.fun.pem;
ssl_certificate_key /tmp/123.linlin.fun.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
try_files $uri $uri/ /index.html;
}
}
server {
listen 80;
server_name www.123.linlin.fun 123.linlin.fun;
return 301 https://123.linlin.fun$request_uri;
}如果不使用ssl:
server {
listen 80;
server_name www.123.linlin.fun 123.linlin.fun;
charset utf-8;
root /tmp/dist;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}