How to Setup a Private Proxy Server on EC2 in Under 10 Minutes

I’ve been slacking a bit with regular blog posts, so I thought I would catch up again with something simple yet useful.

This post will show you how to setup a simple private proxy server on Amazon Elastic Compute Cloud (EC2) and how to tunnel into it via SSH from your PC. Although your anonymity is probably not 100% guaranteed, you will be able to hide your identity from most sites and bypass most country restrictions.

Let’s start with AWS.

Create an Amazon Web Services (AWS) Account

First thing you will need is an AWS account. Go to the AWS Portal and sign up.
You will need a credit card to complete this process.

Why AWS? It is my preference, they commit to 99.95% uptime and they offer 750 hours of Amazon EC2 Micro Instance usage as part of their free usage tier.

Although this post primarily uses AWS, these steps can easily be replicated on any VPS hosting service like Linode.

Creating an EC2 Instance

Once you are verified and logged in, proceed to the EC2 service in the AWS Management Console and from the EC2 Dashboard click the Launch Instance button. Follow the steps and launch the instance.

If you did not create or use an existing Security Group, the one that gets created with the instance should be more than sufficient. The most important thing is to ensure that incoming connections are allowed over port 22.

Once your instance has been started and is up and running, take note of the Public DNS, as you will need it to connect via SSH.

NB. Unless you use an Elastic IP, the Public DNS will change every time you restart the instance.

Installing Tinyproxy

Tinyproxy is a small and fast HTTP/HTTPS proxy server daemon.

Connect to your instance using the key pair you downloaded:

1
ssh -i ~/.ssh/kp-ergo-proxy.pem ubuntu@ec2-54-242-82-159.compute-1.amazonaws.com

Install Tinyproxy

1
sudo apt-get install tinyproxy

By default Tinyproxy listens on port 8888 and only accepts local connections. This is not a problem since we will be tunneling in via SSH.

Tunneling

Open your terminal and start digging.

1
ssh -L 3128:localhost:8888 -N -i ~/.ssh/kp-ergo-proxy.pem ubuntu@ec2-54-242-82-159.compute-1.amazonaws.com
  • -L port:host:host-port Specifies that the given port on the local (client) host is to be forwarded to the given hostand host-port on the remote box.
  • -N Do not execute any remote commands.

The above command can be added to either your .bashrc or .zshrc as an alias.

.zshrc

1
alias proxystart="ssh -L 3128:localhost:8888 -N -i ~/.ssh/kp-ergo-proxy.pem ubuntu@ec2-54-242-82-159.compute-1.amazonaws.com"

I won’t be covering Windoze in this post, but here is an article on how to setup tunneling using PuTTY.

Configuring Your Network

All major operating systems will allow you to edit proxy settings under the network settings or some similar place. In OS X, edit your network connection’s Proxy settings as follows:

Finally, to confirm everything is working visit smart-ip.net and you should see something like this:

Set up a cron task to restart Tinyproxy periodically to save memory

This isn't absolutely necessary to get this running, but if you're going to leave Tinyproxy running all the time and not restart your machine, then it will eventually eat all your memory and lock up your server.  Open up root's crontab:

sudo crontab -e

And add the following lines

0 22    * * *   root    /etc/init.d/Tinyproxy restart

That's a tab after the 22, tab after the last *, and tab after root.  Also add a final return at the end so you have one extra blank line in the file.

How to Setup a Private Proxy Server on EC2 in Under 10 Minutes的更多相关文章

  1. [Node] Setup an Nginx Proxy for a Node.js App

    Learn how to setup an Nginx proxy server that sits in front of a Node.js app. You can use a proxy to ...

  2. Setup a private http/nginx based GIT server

    原文:http://aaba.me/blog/2014/03/setup-a-private-http-nginx-based-git-server.html https://doomzhou.git ...

  3. Setup a Simple HTTP Proxy Server

    The host 10.21.3.69 has no H3C client, so it can't access the internet. With Tinyproxy, we can setuu ...

  4. Proxy Server代理服务器(轉載)

    宽带IP城域网开通以来,单位连上了宽带网,10M的带宽让我们感受到了宽带的魅力.电信只提供7个IP地址,对任何一个单位来说都太少了,常用的解决办法是使用代理服务器.微软的MS Proxy Server ...

  5. Proxy Server源码及分析(TCP Proxy源码 Socket实现端口映射)

    版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/u014530704/article/de ...

  6. How to setup vsftpd FTP file Server on Redhat 7 Linux

    Forward from: https://linuxconfig.org/how-to-setup-vsftpd-ftp-file-server-on-redhat-7-linux How to s ...

  7. FTP Proxy Server

    本文将在Linux环境下实现一个简单的FTP代理服务器,主要内容涉及FTP主动/被动模式和简单的Socket编程. 1. 主动模式和被动模式 FTP有两种模式,即主动模式(Active Mode)和被 ...

  8. 502 Proxy Error The proxy server received an invalid response from an upstream server

    Proxy Error The proxy server received an invalid response from an upstream server. The proxy server ...

  9. proxy server 代理服务器

    有时候,我觉得自己需要去搞明白.搞清楚一个概念,帮我打通一下自己的知识体系,或者说,尝试联络起来. 1. 简介 突破自身IP限制,访问国外站点. 访问单位或者团体内部资源. 突破中国电信的IP封锁. ...

随机推荐

  1. Android之AlterDialog介绍

    效果: 1.简单对话框 AlertDialog.Builder builder=new AlertDialog.Builder(AlterDialogActivity.this); builder . ...

  2. 合成(Composite)模式

    一. 合成(Composite)模式 合成模式有时又叫做部分-整体模式(Part-Whole).合成模式将对象组织到树结构中,可以用来描述整体与部分的关系. 合成模式可以使客户端将单纯元素与复合元素同 ...

  3. .net core MVC Filters 过滤器介绍

    一.过滤器的优级依次介绍如下(逐次递减): Authorization Filter ->  Resource Filter -> Acton Filter -> Exception ...

  4. 将.net core 发布到Linux上的一些坑

    目前遇到的,之后遇到再加 1.时间格式要用.ToString("yyyy-MM-dd HH:mm:ss"); 2.文件路径要用Path.Combine(),IHostingEnvi ...

  5. .net core .NET Core与.NET Framework、Mono之间的关系

    .NET Core与.NET Framework.Mono之间的关系 首先想要知道.NET Core与.NET Framework.Mono之间的关系,就必须他们分别是什么,有什么用途? 一. .ne ...

  6. 如果plsql连接没问题,但程序中报ORA-12504的错误

    说明程序中配置数据库连接的地方没有写tnsnames.ora中的SERVICE_NAME,或者SERVICE_NAME写的有错,检查一下,改正应该就好了

  7. memcached 和 redis 安装

    memcached 1.搭建好lnmp 2.安装依赖包 yum install -y libevent-devel 3.安装memcached $ cd /usr/local/src $ wget h ...

  8. 浅谈HTTP和TCP的理解

    TCP协议对应于传输层,而Http协议对应于应用层,Http协议是建立在TCP协议之上的,当浏览器需要从服务器获取网页数据的时候,会发出一次Http请求.HTTP会通过TCP建立一个连接通道,当HTT ...

  9. 【智能算法】变邻域搜索算法(Variable Neighborhood Search,VNS)超详细解析和TSP代码实例以及01背包代码实例

    喜欢的话可以扫码关注我们的公众号哦,更多精彩尽在微信公众号[程序猿声] 00 目录 局部搜索再次科普 变邻域搜索 造轮子写代码 01 局部搜索科普三连 虽然之前做的很多篇启发式的算法都有跟大家提过局部 ...

  10. (Keil) Debug & Simulation 操作

    0x00 printf在MCU環境下print debug error message,利用Logic Analyzer模擬MCU register or GPIO狀態. 若是要要使用printf函數 ...