DEV Community

Cover image for Reverse Proxy with PHP
manish srivastava
manish srivastava

Posted on

Reverse Proxy with PHP

What is reverse proxy?

Suppose you have one VPS SERVER, One IP and some domains. You have different docker / lxc containers . Each container contains some website.
Naturally, each container will have its own internal IP. You don't want to purchase an IP for each domain. Instead, you want to use your public IP as shared ip between domains. Also, only one port 80 is available at host so all containers will need to listen it.

Reverse proxy is resolve a request URL to another server machine (or same server with different port) as a remote location. It get the content from the remote location and then return back to the client who request the URL. The content or the header information can be modified before returning to the client, and the raw content may be stored as cache files or inside a database. A Reverse proxy can be a building block for other applications, such as
-Acting as a load balancing server
-Acting as a fail-over standby server
-Cope with a web server
acting as a cache server
acting as a search engine friendly front end
acting as a content filter
-Portal Front end which served by different type of web-services from different server.

Reverse Proxy will help you.
Standard solution is HAPROXY and nginx. Please search.

In this post, I am sharing two projects to achieve the same:

  1. SPIKE: ( Reverse Proxy) Spike is a fast reverse proxy built on top of ReactPHP that helps to expose your local services to the internet

GitHub logo slince / spike

📣 A fast reverse proxy written in PHP that helps to expose local services to the internet

Software License Build Status Coverage Status Latest Stable Version Scrutinizer

Spike is a fast reverse proxy built on top of ReactPHP that helps to expose your local services to the internet.



Install via composer

composer global require slince/spike

Both the server and local machine need to install this.

Schematic diagram

Configure the server

A public machine that can be accessed on the internet is needed. Assuming already. There are two ways to start the server

Based on defaults

Use the following command to start the server

$ spiked --address=

The above command can create a basic service. If you want to customize more information, you should start the server based on the configuration file.

Based on the configuration file.

  • Creates a configuration file

Execute the following command to create it.

$ spiked init --dir=/home/conf --format=json

Yaml,Xml,Ini and Json(default) files are supported. Use the following command for help.

$ spiked init -h
  • Open the configuration file and modify the…

  1. Domain Fwd & Reverse Proxy:

You are most welcome to join my team

Alt Text

Click here for joining my team .

Also you are most welcome to join OPEN SOURCE INTELLIGENT SYSTEM (OSINT) if you can help in open source project regarding safeguarding humans from various diseases like CORONA outbreak

Contact email:

If you have any problem, our team is also engaged in professional consultancy and delivery.

Imagecredit: pixabay

Top comments (0)