2 <a href="https://svrjs.org" target="_blank">
3 <img src="assets/logo.png" width="384">
7 <b>SVR.JS</b> - a web server running on Node.js<br/>
8 It's free as in freedom, scalable, secure, and configurable.
11 <a href="https://svrjs.org/docs" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/Documentation-green"></a>
12 <a href="https://svrjs.org" target="_blank"><img alt="Website" src="https://img.shields.io/website?url=https%3A%2F%2Fsvrjs.org"></a>
13 <a href="https://hub.docker.com/r/svrjs/svrjs" target="_blank"><img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/svrjs/svrjs"></a>
14 <a href="https://github.com/svr-js/svrjs" target="_blank"><img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/svr-js/svrjs"></a>
15 <a href="https://x.com/SVR_JS" target="_blank"><img alt="X (formerly Twitter) Follow" src="https://img.shields.io/twitter/follow/SVR_JS"></a>
16 <a href="https://mastodon.social/@svrjs" target="_blank"><img alt="Mastodon Follow" src="https://img.shields.io/mastodon/follow/111643338718098121"></a>
23 ### Static file handling
25 * Static file serving (even above 2GB)
26 * Directory listing serving
27 * Protection against path traversal
28 * Content-Range support (for non-HTML static files; also for HTML files from SVR.JS 3.15.1)
29 * Serving from web root different than SVR.JS installation directory
36 * Protection against HTTP authentication brute force attacks (from SVR.JS 3.4.8; enabled by default)
37 * Ability to hide server version
38 * OCSP stapling support (from SVR.JS 3.4.9)
40 ### Configuration and customization
42 * Configurability via _config.json_ file
43 * Expandability via server-side JavaScript and mods
44 * Ability to serve non-standard error pages
45 * URL rewriting engine
46 * Event driven architecture powered by Node.js, along with clustering.
48 ### Compression and content delivery
50 * Brotli, gzip and Deflate HTTP compression (Brotli supported since SVR.JS 3.4.11)
51 * SNI (Server Name Indication) support
52 * ETag support (from SVR.JS 3.6.1)
53 * Reverse proxy functionality (requires reverse-proxy-mod SVR.JS mod)
54 * Forward proxy functionality (requires forward-proxy-mod SVR.JS mod)
56 ### Authentication and access control
58 * HTTP basic authentication
60 ### Gateway interfaces
62 * CGI (Common Gateway Interface) support (requires RedBrick mod)
63 * SCGI (Simple Common Gateway Interface) support (requires OrangeCircle mod)
64 * JSGI (JavaScript Gateway Interface) support (requires YellowSquare mod)
65 * PHP support (PHP-CGI with RedBrick mod or PHP-FPM with GreenRhombus mod)
67 ### Additional functionality
70 * Ability to display IP addresses, from which originally request was made (from reverse proxies; via X-Forwarded-For)
74 To build SVR.JS, you need Node.js 18.0.0 or newer.
76 Before building SVR.JS, install the npm packages using this command:
80 After installing the packages, build SVR.JS with this command:
84 After running the command, you will get bundled SVR.JS script, around with built-in utilities and assets in the `dist` directory. You will also get a zip archive in `out` directory, that can be installed using SVR.JS installer. Additionally, you will get the SVR.JS Core package contents in the `core` directory, which you can publish by running `npm publish` in the `core` directory.
86 ## Installation (built from source)
88 To install SVR.JS you just built from the source code, you can install it via SVR.JS installer for GNU/Linux or manually.
90 If you want to install SVR.JS manually, you can read the [server documentation](https://svrjs.org/docs).
92 If you want to install via SVR.JS installer for GNU/Linux, run this command:
94 curl -fsSL https://downloads.svrjs.org/installer/svr.js.installer.linux.20240509.sh > /tmp/installer.sh && sudo bash /tmp/installer.sh
97 You will be then prompted about the type of installation. Choose option “2” to install SVR.JS from the zip archive, and type in the path to the zip archive (hint: it is in the `out` directory).
99 After typing the path, you may be prompted to install dependencies via GNU/Linux distribution’s package manager. Proceed with the installation of dependencies.
101 After installation, SVR.JS should be listening at http://localhost.
103 ## SVR.JS documentation
105 You can read the [SVR.JS documentation](https://svrjs.org/docs) to get information on how to use SVR.JS.
109 - To build SVR.JS along with the default page and the zip archive, run `npm run build`.
110 - To build the default page, run `npm run build:page`.
111 - To test SVR.JS itself, run `npm run dev`. This removes existing configuration.
112 - To run the development server for the default page (built with Astro), run `npm run dev:page`.
113 - To check SVR.JS code and default page for errors with ESLint, run `npm run lint`.
114 - To fix and beautify SVR.JS code and default page with ESLint and Prettier, run `npm run lint:fix`.
115 - To run SVR.JS from the "dist" folder, run `npm start`.
116 - To perform unit tests with Jest, run `npm test`.
120 See [SVR.JS contribution page](https://svrjs.org/contribute) for details.
124 This project is licensed under the MIT/X11 License - see the [LICENSE](LICENSE) file for details.