Home Web Servers Servy – A Tiny Web Server to Run Basic Website

Servy – A Tiny Web Server to Run Basic Website

Web servers can be generalized into two segments; the ones for running dynamic sites with configured complexities like databases software and the ones for running a simple static web front-end.

Servy web server qualifies as an ideal candidate for running a simple/basic website with no backend/logic code attached to it.

This article will walk us through understanding and configuring the Servy web server so that you can be able to comfortably run your simple websites before associating them with a backend code.

Installing Servy Tiny Web Server in Linux

It is always a good idea for Linux users to ensure their systems are up-to-date through their respective package managers.

$ sudo apt install update         [On Debian, Ubuntu and Mint]
$ sudo yum install update         [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo pacman -Syu                [On Arch Linux]
$ sudo zypper update              [On OpenSUSE]    

Next, you need to clone the Servy repository using the following wget command.

$ wget https://github.com/zethra/servy/archive/refs/heads/master.zip

To extract the master.zip file we just downloaded, we need to make sure that the unzip package is installed on our Linux system.

$ sudo apt install unzip         [On Debian, Ubuntu and Mint]
$ sudo yum install unzip         [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo pacman -S unzip           [On Arch Linux]
$ sudo zypper install unzip      [On OpenSUSE]    

We can now proceed and extract the master.zip file containing the Servy web server.

$ unzip master.zip
$ cd servy-master
$ cd src
Servy Files
Servy Files

Since Servy web server is written in a rust programming language, programs written with this programming language have the .rs extension as depicted on the above screen capture.

Installing Rust Programming Language in Linux

Before we can compile the rust file ~/servy-master/src/main.rs, we must first install rust programming language on our Linux systems.

$ sudo apt install rustc        [On Debian, Ubuntu and Mint]
$ sudo yum install rust         [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo pacman -S rust           [On Arch Linux]
$ sudo zypper install rust      [On OpenSUSE]    

Next, create the Servy web server executable using Cargo.

$ cd servy-master
$ cargo build 
Create Servy Web Server Executable
Create Servy Web Server Executable

After running the above command, you should note some changes in the main servy-master directory like the creation of the ~/servy-master/target/debug directory points to Servy Web server binary/executable file.

$ cd servy-master/target/debug
Servy Executable Files
Servy Executable Files

Running Basic Website Using Servy Web Server

We can run the web server from the servy-master directory with the following command:

$ ./target/debug/servy 

The web server will start running on port 8000.

Start Servy Web Server
Start Servy Web Server

If you access the above URL from a browser, you will get its directory listing view.

Servy Directory Listing
Servy Directory Listing

Serving Basic Website Using Servy Web Server

You will need to point to the directory that contains the website pages Servy needs to serve. For instance, if your website files reside in /var/www/html directory:

$ ./target/debug/servy /var/www/html
Run Website with Servy Web Server
Run Website with Servy Web Server

The web view will be as follows:

View Website Pages
View Website Pages

The following command provides additional options on the usage of this web server.

$ ./target/debug/servy --help 
Servy Web Server Usage
Servy Web Server Usage

Servy web server is ideal for web developers that want to perfect the responsiveness of their website projects on a development environment before migrating to a production environment. It is easy and faster to set up and uses minimal CPU resources.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.