Run Mirror Proxy Site.
- Create mirror site directory and install WeedProxite (You need to install Node.js and NPM first):
mkdir my-site
cd my-site
npm install --production git+https://github.com/Behemouth/WeedProxite.git
# If you want to install global, add '-g' option
# npm install --production -g git+https://github.com/Behemouth/WeedProxite.git
- Init site:
export PATH="$(npm bin):$PATH";
proxite init
# Or use relative path
# ./node_modules/.bin/proxite init
- Configure, edit
config.js
, you can override withconfig.json
:
module.exports = {
"upstream": "http://upstream-target-site.com",
"port":"1984",
"mirrorLinks": ["http://your-mirror-site-domain:1984/"],
"allowHosts":[
"sub-domain-of.upstream-target-site.com",
"another-example-target-site.com"
]
}
-
Run
node main.js
or use PM2pm2 start main.js --name my-mirror
for production. -
Don't forget to set a daily restart Node.js server cronjob on production server if you enabled
httpsOptions
coz of Node.js HTTPS module memory leaks.
Example config file please see lib/tpl/config.coffee
.
More config options please see lib/Config.coffee
.
-
Please refer to this turtorial to install Nginx: https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-for-apache
-
Run mirror site:
node main.js
-
Proxy pass to Node.js app server, for example your bind host is lo and port is 1984 :
location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; # ....Other configurations proxy_pass http://127.0.0.1:1984; }