December 1, 2010

Bypass Heavy-Handed Web Filters with Your Own Proxy Server


If your workplace or school's extra-restrictive internet filter has you pulling your hair out during the occasional browsing break, there's hope! Here's a quick look at how to get around heavy-handed browser restrictions with the open-source PHProxy.

Back in January we pointed you toward PHProxy, along with some instructions for setting it up on a web server; fact is, most people don't actually have access to a web server to run something like PHProxy. The solution: Install a local web server on your home computer, then run PHProxy from there. Setting one up is actually a lot easier than you may think.

A quick crash course on proxy servers: Let's say your dastardly workplace blocks you from reading Lifehacker. Many web filters block web sites based on URLs, so if Lifehacker were blocked, the filter would recognize the URL http://lifehacker.com and automatically block any connection. A proxy acts as a go-between for your browser and the web site you want to access, and as far as the web filter can tell, the proxy-employing user isn't visiting Lifehacker—she's visiting whatever the URL is for the proxy. And since we're setting PHProxy on your home computer, chances are slim that the web filter will block your home IP address (or URL, which we'll talk about more below).

When you're done here, you should be able to access restricted sites from anywhere by routing your requests through your home computer. First I'll explain how to install a local web server on your computer (for Windows and then Mac users), then explain how to install and use PHProxy from there, and finally I'll walk you through how to access your newly minted local proxy server easily from any other computer.

Download and Unzip PHProxy

Regardless of your OS of choice, the first step is easy: Head over to SourceForge and download PHProxy, then unzip your download to a folder and name that folder phproxy. Put it in a safe place, and we'll get back to it later.

Install a Local Web Server on Your Windows PC

In order to run PHProxy on your home computer, you'll need to install a local web server. You've got lots of options for doing this, but probably none easier than just downloading and installing WAMP—which stands for Windows (your operating system), Apache (the web server), MySQL (a database, which PHProxy won't actually use), and PHP (the popular programming language, which PHProxy is named for and written in).

Once you've downloaded WAMP, go ahead and run through the installer. It's a pretty basic install, and when you're done, launch the WAMP system tray application. After you do, you'll notice a new icon in your system tray (it's the one that looks like a speedometer). WAMP's running, but it's still not turned on. To put WAMP online, left-click the system tray icon and click Put Online.

Now, to verify that everything's working, left-click the WAMP icon in the system tray again and click Localhost—or just point your browser to http://localhost/. If all's well, your browser should load a page that looks like the one below.

Good work—you now officially have a web server up and running on your PC. You can skip the Mac section and head straight to the section on installing PHProxy to your server.

Install a Local Web Server on Your Mac

Above, Windows users installed a web server bundle called WAMP—in which the 'W' stood for Windows. Mac users, appropriately, have MAMPMac, Apache (the web server), MySQL (a database that you won't actually be using), and PHP (a popular web programming language after which PHProxy is named). So go download MAMP (it's a hefty 156MB download) and install it to your Applications folder (make sure you install the free version and not the Pro version).

Now it's time to fire up MAMP. Open the MAMP folder you dragged to your Applications folder, then double-click MAMP.app to launch it. On this first run, click the Preferences button in MAMP, click Ports, and then click the Set to default Apache and MySQL ports button. Hit OK (enter your password to confirm), then point your browser to http://localhost/ (or http://localhost/MAMP/ if you want to see the MAMP landing page). If everything's working as it should you should see a page called "Index of /" at localhost, or the page below if you go to the MAMP URL.

Good work, you're officially running a local web server on your Mac. Now to PHProxy.

Install PHProxy on Your Server

Now we want to install PHProxy on your server. I'm using "install" pretty loosely here; assuming you've already downloaded and unzipped PHProxy to a folder named phproxy, all you really need to do is copy that folder to the root directory of your local web server.

To find your server's root directory on Windows, just click the WAMP system tray icon and click www directory (which, on my Windows 7 installation, is located at C:\wamp\www\. Inside this folder you should see a file called index.php—that's the page that loaded when you pointed your browser to http://localhost/ above. Now simply take the phproxy folder you unzipped PHProxy to above and drag it directly inside the www folder.

Mac users, the MAMP root directory is located inside the MAMP folder at /Applications/MAMP/htdocs/. Likewise, just open that folder and copy the phproxy folder to it.

And… there you have it-you've officially installed PHProxy. To make sure it worked, point your browser to http://localhost/phproxy/. You should see the page below.

(Click the image above for a closer look.)

To test it further, all you have to do is type or paste the URL you want to visit into the web address input box and hit Enter. Below you can see me visiting Lifehacker through my PHProxy installation.

(Click the image above for a closer look.)

Depending on what your web filter is blocking, you can tweak the way PHProxy works—you can show or block images, allow or reject cookies and scripts, encode the URL you're visiting into a string that's complete gibberish, and more. Handy, huh?

Set Up Port Forwarding and a Friendly URL

At this point PHProxy should be working fine from your home computer, which is all well and good, but now we need to make it easy for you to access your local PHProxy installation from outside your home. To do so, we're going to have to set up port forwarding, then optionally we'll give your PHProxy server a friendly URL.

Set Up Port Forwarding on Your Router: When you try to communicate with your home computer from outside your local network, the request first has to go through your router—which then identifies which computer the request is intended for and sends it on its merry way. When you're running a web server on your home computer, other computers looking to communicate with that server will try communicating with it on port 80 (you don't really need to know what any of that means; web servers generally communicate on port 80, and that's what browsers try to access by default). So when your router receives a request on port 80, you need to tell it that those requests should be forwarded to your local PHProxy server.

Rather than detail the entire process, I'll point you toward our previous guide to accessing a home server behind a router/firewall. All routers are a little different, and that's a general guide, so if you want more specifics, try visiting PortForward.com, selecting your specific router model, and finding the instructions for setting up port forwarding with Apache (the web server).

If you've successfully set up port forwarding, you should now be able to access your home server by visiting your network's external IP address (this is the single address that identifies your home to all the other computers on the internet). Quickly point your browser to What Is My IP and copy the series of numbers following "Your IP Address Is:", paste that into your browser's address box, and hit Enter. If everything went according to plan above, your browser should now load up your local server. Add /phproxy/ to the end of your IP address and you should see the PHProxy homepage. Smooth.

Now that your web server is accessible to the outside world, you don't want to let just anyone access it, so at this point it's a good idea to password protect your server. We've already been down this road before, too, so rather than explain it all here, head to step three in our guide to setting up a personal home web server. (For a little extra help generating the necessary password files, I also like web site Htaccess Tools.)

Set Up a Friendly URL: You could stop at that point, but that series of numbers that makes up your IP address isn't all that friendly, and in fact, if your ISP assigns you a dynamic IP, it could change regularly. Luckily you can assign a friendly domain name to your home proxy server for free using DynDNS.com, a process that we've detailed in the past.

By assigning a domain name to your home server, you can create an easy-to-remember viagra buy uk URL like mycrazyproxy.selfip.com, rather than typing in 76.189.XX.XXX every time you want to access your home server.

A Few PHProxy Pointers

PHProxy is an excellent tool, but you should also be aware of the concessions you're making when using it. For example, you should expect your browsing experience to slow down considerably when you're browsing through your home proxy. Remember, your requests are being routed through your home proxy server every step of the way, which puts a rather slow middleman (your home network) between you and the web sites you want to access.

Also, while PHProxy works like a charm for most plain old browsing, it can be tricky when it comes time to log into some web sites. For example, I could log into Twitter without any issues, and I was able to get to the static HTML version of my Gmail account and Facebook, but—though I was able to log in—I had trouble viewing either until I told PHProxy to remove scripts. In fact, I found that removing scripts was a good step whenever I had trouble with sites I wanted to log into.

Last, a Note on Responsibility

Setting up your own proxy is a fun project, but a few things to keep in mind if you're actually planning to use it in your workplace:

  • Even if you're using a proxy, your employer can still see everything you're doing on the internet (and your computer), whether they're watching the data as it comes to your computer or they're literally watching your screen.
  • Some employers actually forbid the use of proxies in their employee agreements, so if you get caught, you could face some very serious consequences (like, you know, getting fired), so use at your own risk.

Got your own tried and true method for accessing blocked web sites? Have a web filter that just won't be defeated? Prefer not to mess with the establishment? Share your thoughts and experience in the comments.

Permalink • Print • Comment

Leave a comment

You must be logged in to post a comment.

Made with WordPress and a healthy dose of Semiologic • Sky Gold skin by Denis de Bernardy