Monday, September 2, 2013

How to set up a simple proxy server on Digital Ocean/ VPS

SSH in to your digital ocean droplet and run the following

sudo apt-get install tinyproxy #install tinyproxy
which tinyproxy # make sure tinyproxy is installed
ps -ef | grep proxy # make sure tinyproxy is running

Now forward a port from your server/machine to the remote proxy on the droplet
ssh -N root@dro.ple.tip.xxx -L local_port:localhost:remote_port
e.g. ssh -N root@198.199.xxx.xxx -L 8000:localhost:8888

Send a request to localhost at port 8000 and see if it appears in the tinyproxy logs. If you are using ruby to do crawling/scraping on websites you can set proxy on the agent:

agent.set_proxy localhost, 8000agent.get("somewebsite")

See the results on your droplet appear in:
/var/log/tinyproxy.log

1 comment:

  1. Can I set username and password for the proxy??

    ReplyDelete