xerver

command module
v0.0.0-...-693c21a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2016 License: MIT Imports: 12 Imported by: 0

README

xerver v3.0

A transparent blazing fast fastcgi reverse proxy .

Features

  • Cross platform .
  • Accelerated and optimized without modules hell.
  • No configurations needed .
  • Standalone, Tiny & Lightweight .
  • Supports both http and https .
  • Automatically use HTTP/2 "in https" .
  • Control the whole webserver just with your preferred programming language .
  • Tell xerver to perform some operations using http-headers, i.e "send-file, proxy-pass, ... etc" .
  • More is coming, just stay tuned .

How It Works

  • A request hits the xerver .
  • xerver handles the request .
  • xserver send it to the backend fastcgi process and the main controller file .
  • the controller file contains your own logic .
  • fastcgi process reply to xerver with the result .
  • xerver parse the result and then prepare it to be sent to the client .

Building from source

1- make sure you have Golang installed .
2- go get -u github.com/alash3al/xerver
3- go install github.com/alash3al/xerver
4- make sure $GOPATH in your $PATH env var .
5- xerver --help

Example (1)

Only acts as a static file server by default on port 80

xerver --root=/path/to/www/ --http=:80

Example (2)

Listen on address 0.0.0.0:80 and send the requests to ./controller.php

xerver --backend=unix:/var/run/php5-fpm.sock controller=./controller.php --http=:80

** OR Listen on address 0.0.0.0:80 & 0.0.0.0:443 ** and send the requests to ./controller.php

xerver --backend=unix:/var/run/php5-fpm.sock controller=./controller.php --http=:80 --https=:443 --cert=./cert.pem --key=./key.pem

Open your ./controller.php and :

<?php
	
	// uncomment any of the following to test it .

	// here you perform your own logic
	// echo "<pre>" . print_r($_SERVER, 1);

	// some xerver internal header for some operations
	// 1)- tell xerver to serve a file/directory to the client .
	// header("Xerver-Internal-FileServer: " . __DIR__ . "/style.css");
	
	// 2)- tell xerver to serve from another server "act as reverse proxy" .
	// header("Xerver-Internal-ProxyPass: http://localhost:8080/");

	// 3)- tell xerver to hide its own tokens "A.K.A 'Server' header"
	// header("Xerver-Internal-ServerTokens: off");

	// the above headers won't be sent to the client .

Open your browser and go to localhost or any localhost paths/subdomains .
You can use xerver.php as a production ready controller file

Author

By Mohammed Al Ashaal

Documentation

Overview

xerver 3.0, a tiny and light transparent fastcgi reverse proxy, copyright 2016, (c) Mohammed Al Ashaal <http://www.alash3al.xyz>, published uner MIT licnese . ----------------------------- *> available options >> --root [only use xerver as static file server], i.e "/var/www/" . >> --backend [only use xerver as fastcgi reverse proxy], i.e "[unix|tcp]:/var/run/php5-fpm.sock" . >> --controller [the fastcgi process main file "SCRIPT_FILENAME"], i.e "/var/www/main.php" >> --http [the local http address to listen on], i.e ":80" >> --https [the local https address to listen on], i.e ":443" >> --cert [the ssl cert file path], i.e "/var/ssl/ssl.cert" >> --key [the ssl key file path], i.e "/var/ssl/ssl.key" *> available internals >> Xerver-Internal-ServerTokens [off|on] >> Xerver-Internal-FileServer [file|directory] >> Xerver-Internal-ProxyPass [transparent-http-proxy]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL