docs - getting started

This commit is contained in:
Cypro Freelance 2024-06-24 13:55:54 +05:30
parent bdadb064c7
commit facf253346
3 changed files with 125 additions and 5 deletions

View file

@ -1,4 +1,4 @@
{
"index" : "Getting Started",
"test": "Test"
"index": "Getting Started",
"configuration": "Configuration"
}

View file

@ -0,0 +1,23 @@
---
title: Configurations
---
## Configuration
SVR.JS can be configured by modifying _config.json_ file.
### _config.json_ properties
The _config.json_ file contains various properties that you can customize to configure SVR.JS according to your specific requirements. Below are the available properties:
#### General Configuration
- _users_ (Array of Objects, SVR.JS 3.0.0 or newer)
- Users list for HTTP authentication. Use _svrpasswd_ tool to add, modify or delete users.
- _name_: User name for HTTP authentication (String)
- _pass_: Salted hash of the password (default SHA256 with appended salt, String)
- _salt_: Salt used to generate the SHA256 hash (String)
- _pbkdf2_: Flag used to determine, if hash is PBKDF2 (Boolean, SVR.JS 3.7.0 or newer)
- _scrypt_: Flag used to determine, if hash is scrypt (Boolean, SVR.JS 3.7.0 or newer)
- _port_ (Number or String, required)
- HTTP port for SVR.JS to listen on. For SVR.JS 3.6.0 and later, it can also be a Unix socket or Windows named pipe. For SVR.JS 3.9.0 and later, this can also be an IP address along with a port like \_"192.168....

View file

@ -1,7 +1,104 @@
---
title: Getting started
title: SVR.JS documentation
---
# maybe
# Welcome to the official documentation of SVR.JS!
## asjdiasd
_This documentation is in the public domain._
## First use
### System requirements
#### Minimum
- Node.JS 8.4.0 or newer (SVR.JS 3.4.x and earlier), Node.JS 10.0.0 or newer (SVR.JS 3.5.x and later) / Latest version of Bun (experimental).
- OS supported by Node.JS/Bun.
#### Recommended
- Latest Node.JS LTS version.
- 2-core CPU or better.
- 1.5GB of RAM or more.
- One of tested platforms: Android, FreeBSD, GNU/Linux, Haiku, Oracle Solaris, Microsoft Windows.
### Installation
#### Using SVR.JS installer (installer packages made in April 5, 2024 and later; GNU/Linux only)
The command for SVR.JS installation is available on [the SVR.JS home page](https://svrjs.org). First off, switch to _GNU/Linux_ tab, then copy the command below the tab into the terminal. The command looks something like this:
```sh copy
curl -fsSL https://downloads.svrjs.org/installer/svr.js.installer.linux.20240509.sh > /tmp/installer.sh && sudo bash /tmp/installer.sh
```
The command for SVR.JS installation is available in [the SVR.JS home page](https://svrjs.org). First off, switch to _GNU/Linux_ tab, then copy the command below the tab into the terminal. The command looks something like this: `curl -fsSL https://downloads.svrjs.org/installer/svr.js.installer.linux.20240509.sh > /tmp/installer.sh && sudo bash /tmp/installer.sh`. After starting the installer, you will be prompted to select the type of SVR.JS installation. After selecting the type, SVR.JS installer will install Node.JS, SVR.JS and create SVR.JS service. During installation, you may be prompted for the installation of dependencies. Once the installation is done, the server is started at _http://localhost_.
File structure will look like this:
- _/usr/lib/svrjs_ - SVR.JS installation directory
- _/var/log/svrjs_ - SVR.JS logs
- _/var/www/svrjs_ - SVR.JS web root
- _/etc/svrjs-config.json_ - SVR.JS configuration file (SVR.JS _config.json_)
SVR.JS installer will also install these commands:
- _svrjs-loghighlight_ - SVR.JS log highlighter
- _svrjs-logviewer_ - SVR.JS log viewer
- _svrpasswd_ - SVR.JS user management tool
- _svrjs-updater_ - SVR.JS updater
#### Using SVR.JS installer (installer packages made before April 5, 2024; GNU/Linux only)
SVR.JS now has a brand new installer for GNU/Linux. First, [download SVR.JS installer](https://downloads.svrjs.org/installer), then unpack your SVR.JS installer zip archive. After unpacking the installer, download SVR.JS zip archive (not installer), copy it to the installer directory and rename it to "_svrjs.zip_". Then run SVR.JS installer using `sudo bash installer.sh`. After starting the installer, you will be prompted to select the type of OS (type of GNU/Linux distribution). After selecting the type, SVR.JS installer will install Node.JS, SVR.JS and create SVR.JS service. During installation, you may be prompted for the installation of dependencies. Once the installation is done, restart your server OS or type `systemctl start svrjs` or `/etc/init.d/svrjs start` to start SVR.JS and get a web server on _http://localhost_.
File structure will look like this:
- _/usr/lib/svrjs_ - SVR.JS installation directory
- _/var/log/svrjs_ - SVR.JS logs
- _/var/www/svrjs_ - SVR.JS web root
- _/etc/svrjs-config.json_ - SVR.JS configuration file (SVR.JS _config.json_)
SVR.JS installer will also install these commands:
- _svrjs-loghighlight_ - SVR.JS log highlighter
- _svrjs-logviewer_ - SVR.JS log viewer
- _svrpasswd_ - SVR.JS user management tool
#### Using _create-svrjs-server_ tool
To install SVR.JS using _create-svrjs-server_, first install the utility using `npm install -g svrjs`. Then create a directory, which will contain SVR.JS. Change your working directory to a new one, and run one of those commands:
- `create-svrjs-server lts` - Latest SVR.JS LTS version
- `create-svrjs-server latest` - Latest SVR.JS version
- `create-svrjs-server 3.6.1` - SVR.JS 3.6.1 (replace 3.6.1 with your desired version)
After downloading and installing SVR.JS to your working directory, run `node svr.js` for SVR.JS 3.x or `node svr_new.js` for earlier versions or `bun run svr.js` if you're using Bun instead of Node.JS.
You will then see this message:
```
Decompressing modules...
Deleting SVR.JS stub...
Decompressing SVR.JS...
Restart SVR.JS to get server interface.
```
After running this command again, you'll get a web server on _http://localhost_.
#### Using Docker
To install SVR.JS via Docker, first pull the image using `docker pull svrjs/svrjs` command, or `docker pull svrjs/svrjs:lts` command, if you wish to install LTS version of SVR.JS. Then create and start the Docker container using `docker run --name mysvrjs -d -p 80:80 --restart=always svrjs/svrjs` command (replace `mysvrjs` with desired Docker container name). The file structure is the same, as it would be installed via SVR.JS installer. Once the installation is done, the server is started at _http://localhost_.
#### Manual installation
To install SVR.JS manually, first unpack your SVR.JS zip archive you downloaded from SVR.JS download page. Then change your working directory to one containing SVR.JS script stub, and run `node svr.js` for SVR.JS 3.x or `node svr_new.js` for earlier versions or `bun run svr.js` if you're using Bun instead of Node.JS.
You will then see this message:
```
Decompressing modules...
Deleting SVR.JS stub...
Decompressing SVR.JS...
Restart SVR.JS to get server interface.
```