登陆你的linux VPS,安装nodejs环境。
然后,npm install -g surge
然后,cd到你的vps上的某个静态网站的根目录,我选择的是/usr/local/node-deadsimplelog-site/html/ .
root@AR:/usr/local/node-deadsimplelog-site/html# ls
air-disaster.html chinese-economy.html index.js LICENSE readme.html test-1.html
asset index.html lib package.json style.css test-2.html
root@AR:/usr/local/node-deadsimplelog-site/html# surge . (此命令的意思即是把当前目录的内容上传到
surge.sh网站所提供的静态空间。第一次运行surge时,它会提示你注册一个账号,输入你的email地址和你所选择的密码即可。)
会显示:
Surge - surge.sh
email: surmountain@gmail.com
token: *****************
project path: .
size: 28 files, 688.5 KB
domain: shrill-stew.surge.sh
upload: [====================] 100%, eta: 0.0s
propagate on CDN: [====================] 100%
plan: Free
users: surmountain@gmail.com
IP Address: 45.55.110.124
Success! Project is published and running at shrill-stew.surge.sh
root@AR:/usr/local/node-deadsimplelog-site/html#
访问http://shrill-stew.surge.sh即可看到我的网站http://dsl.smt.biz.st的内容。这样http://shrill-stew.surge.sh 就相当于是我的网站http://dsl.smt.biz.st的一个镜像。
又比如,cd /usr/local/yasbe-site/www
root@AR:/usr/local/yasbe-site/www# ls
index.html static test test-1 test-2 测试-3 空中浩劫 稀奇古怪的中国经济
root@AR:/usr/local/yasbe-site/www# surge .
Surge - surge.sh
email: surmountain@gmail.com
token: *****************
project path: .
size: 11 files, 296.8 KB
domain: perfect-band.surge.sh
upload: [====================] 100%, eta: 0.0s
propagate on CDN: [====================] 100%
plan: Free
users: surmountain@gmail.com
IP Address: 45.55.110.124
Success! Project is published and running at perfect-band.surge.sh
root@AR:/usr/local/yasbe-site/www#
这样访问http://perfect-band.surge.sh,即可看到我的网站http://yb.smt.biz.st的镜像。
项目地址:https://github.com/sintaxi/surge
https://surge.sh/help/getting-started-with-surge
第3个例子:https://full-bee.surge.sh
这个surge.sh比netlify.com更简单好用。
-------------------------------
相关帖子:https://briteming.blogspot.com/2016/12/vpsnetlifycom.html