ghacks Technology News

Run a local proxy server


I was so excited to write this article that I could not sleep well all night. Yesterday I have written an article that explained how you could 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 webserver 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 webserver is up and running at your computer and that the Apache module is started. Download one of the many proxy scripts and unzip it. I suggest you create a new sub directory in htdocs, don’t name it proxy . use a name that does not tell anyone what the files in the directory could be for. This is to prevent keyword filters that could block your local url if they find the keyword proxy in it. Name it tennis for instance.

Move the files index.php, javascript.js, PHProxy.class.php, style.css and url_form.inc into the new directory. Et voila, you are done. Test the script by accessing it locally (http://localhost/tennis/) ; If the proxy script appears everything is fine and you can access it from anywhere on the net as long as your local computer is connected to the web and the apache module is started.

It is highly unlikely that this proxy is banned by the 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.

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.




Tags: , ,
Categories: Knowledge, The Web



Related posts:

Setting up your own proxy server
Web Proxy Server List
Secure your server with htaccess
Automatic Web Proxy Server In Firefox
Ghacks Fast Web Proxy
Proxy Server Usage To Extend Jailtime In The US
Looking for beta testers for new proxy site
Local Apache Web Server Wampserver

21 Responses to “Run a local proxy server”

  1. Ace says:

    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 .

    • Martin says:

      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.

  2. xFilthyxJesusx says:

    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?

  3. Martin says:

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

  4. xFilthyxJesusx says:

    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.

    • Martin says:

      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..

  5. xFilthyxJesusx says:

    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.

  6. boss says:

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

  7. Schnitz says:

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

  8. Martin says:

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

  9. Is there any way of making this simpler to explain ?

  10. ShaiVong says:

    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. julian says:

    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

  12. meeko says:

    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?

  13. axlerose says:

    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

  14. axlerose says:

    I followed the PHP instructions here:
    http://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

  15. axlerose says:

    I am up-and-running with XAMPP and Glype

    youporn, youtube… all works nice !

  16. Need proxy says:

    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: http://www.ghacks.net/2007/02/01/run-a-local-proxy-server/

  17. LuxusElg says:

    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?

  18. mike says:

    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?

Leave a Reply   Follow Ghacks   Subscribe To Comment Rss

© 2005-2009 Ghacks.net. All Rights Reserved. Privacy Policy - About Us