Original post is here: eklausmeier.goip.de
now.sh, previously known under zeit.co, which has now rebranded as vercel.com, allows to host static content. There is no PHP, MySQL/MariaDB, Perl, CGI, etc. While surge.sh is super simple to use, in contrast now.sh uses the notion of 'environment', which can be either development, preview, or production.
First install via npm install now
, then cd
to the directory where you have stored your static content. Then, depending on your environment, deployment is as follows:
- Development:
now dev
, no "real" deployment, but rather web-server is started at localhost:3000. Stop with Ctrl-C. - Preview:
now
ornow deploy
- Production:
now deploy --prod
It is not required to step through all the environments in any order. So you can just always deploy to production. Regardless of the environment, now.sh always creates some additional HTML web area with a generated name. This name might look like now-ll1keyjfk.now.sh
.
The now
command has the following options:
1$ now -h
2> UPDATE AVAILABLE Run `npm i now@latest` to install Now CLI 18.0.0
3> Changelog: https://github.com/zeit/now/releases/tag/now@18.0.0
4
5 𝚫 now [options] <command | path>
6
7 Commands:
8
9 Basic
10
11 deploy [path] Performs a deployment (default)
12 dev Start a local development server
13 init [example] Initialize an example project
14 ls | list [app] Lists deployments
15 inspect [id] Displays information related to a deployment
16 login [email] Logs into your account or creates a new one
17 logout Logs out of your account
18 switch [scope] Switches between teams and your personal account
19 help [cmd] Displays complete help for [cmd]
20
21 Advanced
22
23 rm | remove [id] Removes a deployment
24 domains [name] Manages your domain names
25 dns [name] Manages your DNS records
26 certs [cmd] Manages your SSL certificates
27 secrets [name] Manages your secret environment variables
28 logs [url] Displays the logs for a deployment
29 teams Manages your teams
30 whoami Shows the username of the currently logged in user
31
32 Options:
33
34 -h, --help Output usage information
35 -v, --version Output the version number
36 -V, --platform-version Set the platform version to deploy to
37 -n, --name Set the project name of the deployment
38 -A FILE, --local-config=FILE Path to the local `now.json` file
39 -Q DIR, --global-config=DIR Path to the global `.now` directory
40 -d, --debug Debug mode [off]
41 -f, --force Force a new deployment even if nothing has changed
42 -t TOKEN, --token=TOKEN Login token
43 -p, --public Deployment is public (`/_src` is exposed)
44 -e, --env Include an env var during run time (e.g.: `-e KEY=value`). Can appear many times.
45 -b, --build-env Similar to `--env` but for build time only.
46 -m, --meta Add metadata for the deployment (e.g.: `-m KEY=value`). Can appear many times.
47 -C, --no-clipboard Do not attempt to copy URL to clipboard
48 -S, --scope Set a custom scope
49 --regions Set default regions to enable the deployment on
50 --prod Create a production deployment
51
52 > NOTE: To view the usage information for Now 1.0, run `now help deploy-v1`
53
54 Examples:
55
56 – Deploy the current directory
57
58 $ now
59
60 – Deploy a custom path
61
62 $ now /usr/src/project
63
64 – Deploy with environment variables
65
66 $ now -e NODE_ENV=production -e SECRET=@mysql-secret
67
68 – Show the usage information for the sub command `list`
69
70 $ now help list
71
now.sh stores your credentials in $HOME/.local/share/now/auth.json
.
Added 24-May-2021: Script now
is no longer maintained. You have to use vercel
instead. Install vercel
as usual: npm install vercel
. Steps for deployment are
vercel login
vercel deploy --prod
My static site on vercel.com is here: klm.vercel.app/blog.
Added 15-Jan-2024: Vercel imposes a limit of at most 5,000 requests per day, when you use the free plan.