Run a local proxy server

Martin Brinkmann
Feb 1, 2007
Updated • May 29, 2013
Internet
|
22

I was so excited to write this article that I could not sleep well all night. Yesterday I have published an article that explains how you can setup a webserver on your computer and use it to display websites or share files with your friends. Today I'm going to show you how to use this web server to host a local proxy server that you can access from anywhere on the net to surf sites that are blocked at your current location.

The requirements are that the web server is up and running on your home computer and that the Apache module is started. Download one of the many proxy scripts and unzip it to a server directory.

I suggest you create a new sub directory in htdocs, don't name it proxy but use a name that does not tell anyone what the files in the directory can be used for.This is important as keyword filters may otherwise detect the proxy script based on the name and block you from accessing it. Name it tennis for instance or news.

Test the script by accessing it locally (http://localhost/tennis/) ; If the proxy script appears everything works out fine. Now test it using your remote IP. If the connection works as well, you can access it from any computer with an Internet connection as long as the server is running on your home computer.

Note that you need to know the public IP of your home computer to access the proxy, you can check it here for instance.

It is highly unlikely that this proxy will be banned by admins of your school, university or company because it runs on a dynamic IP and no one has ever used it before.

To secure the directory do the following: Create a .htaccess file - Windows Explorer does not like this kind of files but a good editor should be able to create the file without errors. Add the following lines to the file and save it.


Options All -Indexes
AuthName "Go Away ;)"
AuthType Basic

order deny,allow
deny from all
#Comment 1
allow from 111.111.111.111

This prevents access to the directory to anyone except the user with a matching IP address. This is not a useful protection if you want to prevent the admins from your school or university to take a look at your server, but it will block access for anyone esle.

A better protection would be to use a password protection, this is done the following way:

Create an encrypted password and copy the result in a file named randomly starting with a . - for instance .grqwev ; Place the file into the directory that you want to protect. Add a .htaccess file to the directory with the following lines.

AuthUserFile /tennis/.grqwev
AuthType Basic
AuthName "Top Secret"
Require valid-user

That is it. You password protected your proxy script running on your local computer. Only users who know the password are able to login and use the proxy, everyone else will not be able to see what lies behind the password request.

Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. Glenn said on September 6, 2010 at 7:11 pm
    Reply

    Yeah. I tried that too. I entered my IP address into the browser and got prompted for a username and password? What’s that all about?

  2. mike said on July 1, 2009 at 6:26 am
    Reply

    Using XAMPP with glype, but get a authentication request when entering IP in browser. Tried my user name for computer but no go. have not setup htacsess yet. What did I miss in the instructions?

  3. LuxusElg said on April 3, 2009 at 3:15 am
    Reply

    my proxy works pretty well, but if I try to password protect it with a .htaccess and a .htpasswd file, I just get server error.. :S
    help?

  4. Need proxy said on March 24, 2009 at 4:14 pm
    Reply

    Your IP is: 207.74.27.130
    Remote Port: 35491
    Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0
    Referer: https://www.ghacks.net/2007/02/01/run-a-local-proxy-server/

  5. axlerose said on June 26, 2008 at 9:42 am
    Reply

    I am up-and-running with XAMPP and Glype

    youporn, youtube… all works nice !

  6. axlerose said on June 26, 2008 at 8:13 am
    Reply

    I followed the PHP instructions here:
    https://www.ghacks.net/2006/04/07/setting-up-your-own-proxy-server/

    but couldn’t figure it out; just get a white page when I navigate to http://localhost/tennis/phpproxy.php

  7. axlerose said on June 26, 2008 at 7:47 am
    Reply

    youtube gives me this message:
    Hello, you either have JavaScript turned off or an old version of Adobe’s Flash Player. Get the latest Flash player.

    youporn doesn’t work either

  8. meeko said on June 17, 2008 at 3:57 am
    Reply

    Martin, thank you so much for the useful info.
    Can I browse utube but be able to stream videos?
    I mean, the script running in utube-like sites will pass through as-is?

  9. julian said on February 3, 2008 at 4:38 am
    Reply

    hello great artical i love your post but one probelm when ever i try to acsses the proxy im stuck in my wirless rotour menu

  10. ShaiVong said on December 18, 2007 at 7:24 pm
    Reply

    I can’t get it to work on mine; It just opens up like a web directory of files, it doesn’t run the the scripts. I’m running Apache 2.2, which should be right… Do I have to change some of the local directory lines in my httpd.conf file?

  11. retro computers said on March 9, 2007 at 10:54 am
    Reply

    Is there any way of making this simpler to explain ?

  12. Martin said on March 9, 2007 at 9:40 am
    Reply

    I don’t think so. you need real proxies for those tasks, not web based proxy scripts.

  13. Schnitz said on March 9, 2007 at 8:43 am
    Reply

    Is it possible to change the proxy-script , so that it can be used within a download-manager for example?

  14. boss said on February 13, 2007 at 12:46 pm
    Reply

    I find generally that these “simnple” technical setups are often more complex thatn first anticipated.

    1. Martin said on February 13, 2007 at 6:56 pm
      Reply

      This could hold true in some instances but not with this. It is really easy to setup and use, the only real problem would be a dynamic IP.

  15. xFilthyxJesusx said on February 3, 2007 at 11:35 am
    Reply

    I tried to set up the CGI proxy. and it worked if I didnt put url encoding on but I can’t seem to figure out how to set up the url encoding right. I’m going to look it up and I’ll let you know if I can figure it out if you’d want any information that I have about setting up a cgi proxy jsut let me know and I’ll help you to the best of my ability.

  16. xFilthyxJesusx said on February 2, 2007 at 7:26 am
    Reply

    Thanks for this Martin. I have just been forgetting and forgetting to do this for a long time. I set mine up. (CGI) If you want to see if it’s set up wrong or anything go on ahead. I can actually show you how I set it up.

    http://xFilthyxJesusx.com

    Oh and I forgot to tell you. I have you linked on my site. I hope that’s ok. I really happen to love your site and it’s one of the reason’s I’ve set u a blog aswell. I’ve yet to get it up and running but I plan to make it similiar to yours. If you’d like to be removed of course just let me know. I know my name can be offensive and I wish I wouldn’t have used it but I wasn’t thinking when I set it up.

    1. Martin said on February 2, 2007 at 6:34 pm
      Reply

      The problem with the cgi proxy script is that it really consumes lots of ram and cpu of the server and that it is a burden for the server if you run a popular script..

      As I said, I will take the time and write an article about setting it up locally. I’m also thinking of buying a advanced proxy script and set it up on a new server and offer private proxies for a few dollars and a public one with ads..

  17. Martin said on February 2, 2007 at 6:44 am
    Reply

    Yes the cgi proxy works better but is more complicated to setup. I will write about it soon.

  18. xFilthyxJesusx said on February 2, 2007 at 4:53 am
    Reply

    This one doesn’t seem to work very well. My test to see if a proxy works well is being able to logon to the website MySpace.com because that is the most desired teen website and blocked by almost all censorship software. CGI proxies I think work for this. Or does this one work as well? If not can you point me in the direction of one that does?

  19. Ace said on February 1, 2007 at 11:15 am
    Reply

    Any chance of making this a simpler process for novices ?
    The idea seems great but implemenation for computer novices at work may be a bit over our head .

    1. Martin said on February 1, 2007 at 11:24 am
      Reply

      Well the process itself is not complicated at all. Download XAMP, install it and activate Apache (from XAMP Control Panel in start menu). Download the proxy script and unzip it into the htdocs subdir of the XAMP installation.

      Look up your ip at http://www.ghacks.net/ip and enter the following url into your browser at work. (with the home computer running)

      http://yourip/

      The proxy should appear and you are ready to go. Protecting the directory is optional, creating a subdir as well.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.