承接 buonzz/reverseproxy 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

buonzz/reverseproxy

Composer 安装命令:

composer create-project buonzz/reverseproxy

包简介

PHP Script to perform Reverse Proxy Functionality

README 文档

README

##ReverseProxy PHP Script

A simple PHP script that can be used as a ReverseProxy. Although you can use Nginx, mod_proxy or a dedicated software like Squid for this purpose, there are instances that you favor the ability to just do it in a PHP script that can be dropped in a single folder. There could be various reasons:

  • You are in a shared hosting wherein tweaking server-wide stuffs is not possible
  • For some reason, you have to serve the contents of a subdomain to be as sub-folder of another. For example you have site.yourdomain.com (server 1 ) and you want it to be accesible as www.domain2.com/site in another server
  • You wanted to cache the contents
  • The web server is inaccessible publicly
  • You want to provide a simple proxyserver
  • Visitor's country is restricted from visiting the actual site
  • Anonymize your users

Requirements

  • PHP >= 5.2
  • Apache mod_rewrite enabled
  • cURL extension enabled

Installation

Use composer to install it

composer create-project buonzz/reverseproxy

edit config.php

define('MASKED_DOMAIN', 'http://www.google.com');
define('PROXY_SUBFOLDER', 'reverseproxy');
define('FOLLOW_LOCATION', FALSE);
  • MASKED_DOMAIN is the site where this script will be getting its contents from, should have no traliling slashes.
  • PROXY_SUBFOLDER this is in case you had placed your script in a subfolder, like for example http://www.yourdomain.com/reverseproxy Leave this to blank if you had placed this in the root of the domain
  • FOLLOW_LOCATION - indicates whether the script will follow the redirect returned by the source site

edit .htaccess

RewriteEngine on 
RewriteCond $1 !^(index\.php) 
RewriteRule ^(.*)$ /reverseproxy/index.php/$1 [L]

This directives allows the reverseproxy to catch all the URI intented for the original domain, like for example

http://www.originaldomain.com/blog/102014/hello-world

With this setting, you can use

http://www.yourdomain.com/reverseproxy/blog/102014/hello-world

and the uri will be passed to the index.php and can then be passed to the original domain to rerieve the contents. Remember that if you are serving the contents from the root domain you only need to use this

RewriteEngine on 
RewriteCond $1 !^(index\.php) 
RewriteRule ^(.*)$ /index.php/$1 [L]

统计信息

  • 总下载量: 219
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 20
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 20
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-04-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固