GithubHelp home page GithubHelp logo

multiple-httpd's Introduction

Multiple HTTP demo with Ruby

A simple Ruby script that runs independent instances of the web server in Linux environment. Servers are listening on ports 5001 and above.

Setup

To run this on your system make sure you have Ruby language support with ruby -v command. If not, add Ruby to your system with your favorite package manager. In this example I'm using Ubuntu.

$ sudo apt install ruby
# OR
$ sudo snap install ruby --classic

We will also need Git and Curl, so if you don't have them, install them as well.

$ sudo apt install git curl

Cloning a repository

$ git clone https://github.com/loopold/multiple-httpd.git
$ cd multiple-httpd

Launch

Here is exaple for start 5 instances. The parameter in square brackets defines the number of instances that we want to run:

$ rake start_http_servers[5]

You can see the list of available tasks with rake --tasks

Attention to ZSH

I have noticed in ZSH problem with launching script. In ZSH we have to add noglob prefix or create an alias to rake command: noglob rake in .zshrc

Verify

Servers are listening on ports 5001 and above. You can verify it with curl command in terminal.

$ curl http://localhost:500\[1-5\]

Close

At this stage we can end processes with SIGTERM signal for all Ruby instances:

$ killall ruby

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.