<p>Copy and paste the following command into your Terminal. <strong>Before you pipe any script into your computer, always <ahref="/web-server/install.sh">view the source code</a> and make sure you understand what it does.</strong></p>
<h3id="as-a-development-server">As a development server</h3>
<p>You can also use Site.js as a local development server <strong>with locally-trusted TLS certificates</strong> (no certificate warnings) on Linux, macOS, and Windows.</p>
<p>You can use Site.js as a local development server <strong>with locally-trusted TLS certificates</strong> (no certificate warnings) on Linux, macOS, and Windows.</p>
<p>To start serving the current folder at <ahref="https://localhost:">https://localhost:</a></p>
...
...
@@ -67,31 +67,31 @@
<p>Say you’re running <ahref="https://gohugo.io/">Hugo</a> locally at its default location (<ahref="http://localhost:1313">http://localhost:1313</a>) and you want to test it via TLS:</p>
<p>Now you can view it at <ahref="https://localhost">https://localhost</a> and even your live reload will work as Site.js in proxy mode also proxies WebSockets.</p>
<h3id="as-a-local-development-server-with-live-sync-of-changes-to-your-production-server">As a local development server with live sync of changes to your production server</h3>
<p>Any changes in your <em>current folder</em> will be synced via rsync over ssh to <em>your-account</em>@my-demo.site:/home/<em>your-account</em>/_current-folder-name. You can customise all of those details by providing a fully-formed rsync remote connection string for the `--sync-to` option.</p>
<p>Any changes in your <em>current folder</em> will be synced via rsync over ssh to <em>your-account</em>@my-demo.site:/home/<em>your-account</em>/_current-folder-name. You can customise all of those details by providing a fully-formed rsync remote connection string for the <code>--sync-to</code> option.</p>
<h3id="as-a-staging-server">As a testing server</h3>
<p>To give others access to your server without running as a deployment server (daemon):</p>
<p>Similarly, can also test with proxy servers. For example, if you want to test your Hugo site from your phone, you can expose the local port at your hostname:</p>
<p>Then use, for example, <ahref="https://ngrok.com/">ngrok</a> (Pro+) to point a custom domain name to your temporary staging server. Make sure you set your <code>hostname</code> file (e.g., in <code>/etc/hostname</code> or via <code>hostnamectl set-hostname <hostname></code> or the equivalent for your platform) to match your domain name. The first time you hit your server via your hostname it will take a little longer to load as your Let’s Encrypt certificates are being automatically provisioned by ACME TLS.</p>
<p>Then use, for example, <ahref="https://ngrok.com/">ngrok</a> (Pro+) to point a custom domain name to your temporary staging server. Make sure you set your <code>hostname</code> file (e.g., in <em>/etc/hostname</em> or via <code>hostnamectl set-hostname <hostname></code> or the equivalent for your platform) to match your domain name. The first time you hit your server via your hostname it will take a little longer to load as your <ahref='https://letsencrypt.org/'>Let’s Encrypt</a> certificates are being automatically provisioned by <ahref='https://source.ind.ie/hypha/tools/acme-tls'>ACME TLS</a>.</p>
<h3id="as-a-production-server">As a production server</h3>
<p>Once your server is running, it will survive crashes and server restarts and you can use the following commands:</p>
...
...
@@ -105,9 +105,9 @@
<p>Easily add dynamic functionality to your static site or create a fully-dynamic site. Get started with PHP-like simplicity in JavaScript using simple DotJS (.js) files:</p>
<p>The only difference is that you don’t have to write any other code or worry about anything else including installing Node.js, provisioning TLS certificates, ensuring your site automatically restarts on reboots, etc.</p>
<p>In addition to HTTPS GET and POST routes, you can also specify WebSocket (WSS) routes in DotJS and mix dynamic and static routes. For example, here’s all the server-side code you need to create <ahref='https://source.ind.ie/site.js/app/tree/master/examples/wss-basic-chat'>a very basic chat app</a>:</p>
<p>In addition to static routes and dynamic HTTPS routes, you can also specify WebSocket (WSS) routes in DotJS. You can also mix them as you please.</p>
<p>To test <ahref='https://source.ind.ie/site.js/app/tree/master/examples/wss-basic-chat'>this example</a> with a web interface, do the following and then visit <ahref='https://localhost'>https://localhost</a></p>
<p>The WebSocket functionality is from <ahref='https://github.com/HenningM/express-ws/pull/122'>a slightly modified version</a> of <ahref='https://github.com/HenningM/express-ws'>express-ws</a> (which in turn uses <ahref=''>ws</a>). Both of those links have more usage details.</p>
<p>You can use Site.js as a module in your Node.js projects. See the <ahref="https://source.ind.ie/site.js/app#api">API documentation</a> for details.</p>
<p><ahref="https://source.ind.ie/site.js/app/#sitejs">See the docs</a> for full details, like using <ahref="https://source.ind.ie/site.js/app#custom-error-pages">custom error pages</a> and <ahref="https://source.ind.ie/site.js/app#native-cascading-archives-support">cascading archives</a> and <ahref="https://source.ind.ie/site.js/app#native-404-302-support">the 404→302 technique</a> for an evergreen web.</p>