Testing your local websites on smartphones using a Squid proxy server.

This is a guide to install and configure your own Squid proxy server, for testing and debugging local websites, using your local hosts file to route the requests.

I have a local development environment configured with many VirtualHosts running on my local Apache webserver. I map local domain names to localhost ( in my local hosts-file but that only makes these domains available on my local machine. Using the Squid proxy you can make local domains available for all your external devices.

This guide does not consider security whatsoever. Read the details
of squid.conf to setup your own security after you have installed Squid.

Mac OS


I'm going to use Macports to install Squid, a free proxy server. If
you do not have Macports installed, go check it out – this guide will not work without it.

In terminal, type:

sudo port install squid

Add permissions to cache storage:

sudo chmod -R 777 /opt/local/var/squid

Update Squid configuration

Open the configuration file in your preferred editor:


In the configuration file, locate and uncomment this line:

hosts_file /etc/hosts

Create swap folders

Simply run Squid the first time using the -z parameter to let Squid create the required swap folders. In Terminal run:

squid -z

Run Squid

Start Squid in no daemon mode. This means it runs until you quit it by pressing ctrl-c.

squid -N

Start Squid, do your testing and quit the process when you are done. Thank me later :)

Yes, that's it.

Windows 10


Start with refreshing the software repositories to ensure you are working with the latest software version. Launch yo

Squid is available as a Windows .msi installer from squid-cache.org. Download the latest version and run the installer.

The installer will add a Squid Windows service to your computer and while this is convenient it is also a bit more than we need for just occasional testing. Consider to switch the service to manual, so it doesn't run in the background all the time.

Update Squid configuration

Open the configuration file in your preferred editor:


On Windows this file is located inside the etc folder in the Squid application folder. You can change the install location through the installer, so I don't know where it might be on your computer.

In the configuration file, locate and uncomment this line:

hosts_file C:/Windows/System32/drivers/etc/hosts

If you can't find that line in the configuration file, then just add it to the end of the file.

Restart Squid

Go to Services and restart (or start) the Squid service.

Linux / Ubuntu


Start with refreshing the software repositories to ensure you are working with the latest software versions. Launch your terminal and enter the following command: 

sudo apt-get update

Install squid package on Ubuntu with the following command:

sudo apt-get install squid

The system should prompt for confirmation - enter Y and allow the process to complete itself.

Update Squid configuration

The Squid configuration file is found at /etc/squid/squid.conf.

Open this file in a text editor called "nano" with the following command:

sudo nano /etc/squid/squid.conf

Press “Ctrl+w” to open the search option field. Then type in “http_port 3128” and then press “Enter”. It will take you to “http_port 3128” which is the default port. If the http_port is assigned with some other number, change it to 3128.

Following the same way search for “http_access deny all” and just comment it out by putting a “#” sign infront. Add a new line “http_access allow all”.

Search for “visible_hostname” the same way once again. Delete “#” sign at the beginning of the line. Give a name at the end of the line. i.e  “visible_hostname razu_squid”.

search for “hosts_file /etc/hosts” and uncomment it by deleting the “#” sign.

Exit nano now by pressing “Ctrl+X”. You will be prompt with a set of choices. Type in “Y” to save the changes. Then press “Enter”.

Restart the Squid service with the following command:

sudo systemctl restart squid

To verify that the installation was successful and Squid service is running, type the following command which will print the service status:

sudo systemctl status squid

A successful installation should output like: 

Setting up local domains via your hosts file

To make your local domains available on your test devices update the entries in your local hosts-file pointing them to your own computers local network IP, like: parentnode.proxy

Unfortunately you might need to update this whenever running the proxy server on a new network, or if your IP changes. I use a dual configuration, with one entry for testing on my local machine and another entry for proxy based testing. Thus every local domain entry in my hosts file looks like: parentnode.local
fe80::1%lo0 parentnode.local
::1 parentnode.local parentnode.proxy

Make sure your local Apache is ready to respond to your new proxy domain as well. In the Apache configuration for your project, you can add an Alias for the proxy domain:

ServerName parentnode.local
ServerAlias parentnode.proxy

Note: You cannot access .local domains on iOS devices

Configure proxy on smartphones


Go to Settings on your iOS device. Choose WiFi, and click the i-icon on your network to edit network configuration. Choose Configure Proxy. Choose Manual. Assign the IP-address of your domain.proxy for server and 3128 for port. Follow the image below:

Remember to start Squid on your computer.


Go to Settings on your Android device and choose Wifi. Touch and hold on the active network and choose Modify Network from the menu that shows up.

Choose Advanced options and then select Manual from the proxy options and enter the IP of your local computer and port number for Squid (3128).