From e58b5b6aaac9f4ed94fc30678fe36090523f3915 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Tue, 6 Jun 2017 11:45:35 +0200 Subject: Updating README.md with the same content of the wiki page https://wiki.fd.io/view/Http-server Change-Id: I9c856fc8a4dd60ea00d13aeaa2f990ab59bdaeb4 Signed-off-by: Mauro Sardara --- README.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a317c80c..f5538372 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Dependencies - libboost-system-dev - libboost-filesystem-dev - libicnet +- libcurl Build the HTTP-Server ----------------- @@ -31,11 +32,38 @@ For building the library, from the root folder of the project: Install the HTTP-Server ------------------- +### Installation from binary packages + +Ubuntu 14.04 and Ubuntu 16.04 + +```bash + $ echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io.master.ubuntu.$(lsb_release -sc).main/ ./" \ + | sudo tee -a /etc/apt/sources.list.d/99fd.io.list + $ sudo apt-get update + $ sudo apt-get install http-server +``` + +Centos 7 +```bash +$ cat << EOF | sudo tee -a /etc/yum.repos.d/99fd.io.repo +[fdio-cicn-master] +name=fd.io master branch latest merge +baseurl=https://nexus.fd.io/content/repositories/fd.io.master.centos7/ +enabled=1 +gpgcheck=0 +EOF +$ sudo yum install http-server +``` + +### Installation from source code + For installing the application: ```bash - $ cd build - $ sudo make install +$ mkdir build && cd build +$ cmake .. +$ make +$ sudo make install ``` Usage @@ -49,28 +77,49 @@ For starting the http-server, from the build folder: ``` The server now is: -- serving files from the folder **/var/www/html** -- Listening on the icn name /webserver +- Serving files from the folder **/var/www/html** +- Listening on the prefix http://webserver - Listening on the TCP port 8080 For retrieving a content through icn, the name must have the following format: -`iget http://webserver/get/file.mp4` +```bash +$ iget http://webserver/file.mp4 +``` + +The application iget is available in the package **libicnet**. -The server accept two option through the command line: +The server accept three option through the command line: ```bash $ ./http-server -h - http-server [-p PATH_TO_ROOT_FOOT_FOLDER] [-l WEBSERVER_PREFIX] + http-server [-p PATH_TO_ROOT_FOOT_FOLDER] [-l WEBSERVER_PREFIX] [-x REMOTE_ORIGIN] ``` -The default values are **/vaw/www/html** for the root folder and **ccnx:/webserver** for the icn name. +The default values for the first two parameters are **/vaw/www/html** for the root folder and **http://webserver** as icn prefix served. + +The http-server can also be used as a transparent proxy: if the resources to retrieve are stored in +a remote location and they are available over http, it is possible to retrieve them by specifying their +location when starting the http-server, in this way: + +```bash + $ ./http-server -x myvideos.org +``` + +The server will perform the following operations: + +- When it receives the first client request, it will look for the asked resource locally +- If the resource is not available, it will forward the HTTP request to the remote origin _myvideos.com_ +- The remote origin will reply with the content (or with an error code) +- The reply will be forwarded to the client Platforms --------- -Libicnet has been tested in: +Http-server has been tested in: - Ubuntu 16.04 (x86_64) + - Ubuntu 14.04 (x86_64) - Debian Testing - - MacOSX 10.12 \ No newline at end of file + - MacOSX 10.12 + - CentOS 7 -- cgit 1.2.3-korg