Notes
Surge deployments in 2 minutes
deploying a static site with Surge, passing the domain, saving it in a CNAME file, and pointing a custom domain at it
Web Development
tl;dr
1# install with npm
2npm install --global surge
3
4# OR install with yarn
5yarn global add surge
6
7# run
8surge
- Enter an email and password to signup or login
- Select a directory to publish
- Enter a domain name
- Done!
deployments
If you’re already authenticated, you can directly pass in the directory with the surge command
1# deploy a directory
2surge /public
1# deploy folder while passing the domain name as parameter
2surge public/ --domain myfooo.surge.sh
save your domain name to a CNAME file
You can pass the domain name as a CLI parameter
1surge --domain myfooo.surge.sh
Or you can save it as a CNAME file
1echo myfooo.surge.sh > CNAME
When developing with Gastby, the CNAME file needs to be in the root directory or in the static folder so that it gets copied to your public folder upon build.
using a custom domain
Point your domain to na-west1.surge.sh or 45.55.110.124
# with a CNAME record (@, www)
na-west1.surge.sh
# with an A/AAA record (*)
45.55.110.124
1# deploy to your custom domain
2surge path-to-project/ mydomain.com
3
4# save custom domain name to avoid entering it every time
5echo mydomain.com > CNAME