Score:-1

Squid: * connect to ipaddress port 3128 failed: Connection refused

la flag

I'm setting up a proxy server with squid.

After all the steps, I restarted with
sudo systemctl restart squid.service
which returned: active.
I then attempted to test the connection:

curl -v -x http://your_squid_username:your_squid_password@ipaddress:3128 http://www.google.com/

This error was the result:

Trying ipaddress:3128...
connect to ipaddress port 3128 failed: Connection refused
Failed to connect to ipaddress port 3128 after 1 ms: Connection refused
Closing connection 0
curl: (7) Failed to connect to ipaddress port 3128 after 1 ms: Connection refused

The configuration file /etc/squid/squid.conf has these settings:

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
include /etc/squid/conf.d/*.conf
auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwords
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
# Example rule allowing access from your local networks.
acl localnet src ipaddress
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
#http_access allow localnet
http_access allow localhost
http_access allow authenticated

# And finally deny all other access to this proxy
http_access deny all

I followed this guide. Everything went well until the start of Step 3 when I used curl to test the squid connection.

Is there anything in the squid.conf that needs to be changed? How do you fix this?

Level9 avatar
cn flag
Well, have a look at the Squid logs and see if they give you any clues. They should be available under /var/log/squid.
Andrea avatar
la flag
There are two files under that folder `access.log` and `cache.log`. Both of them are blank.
Score:0
la flag

Instead of the IP address that appears on ip2location.com or similar sites, the ipaddress should be either 127.0.0.1 or localhost. The command should then be curl -v -x http://your_squid_username:your_squid_password@127.0.0.1:3128 or curl -v -x http://your_squid_username:your_squid_password@localhost:3128

Andrea avatar
la flag
I actually managed to get get the status to `active`. Is this exclusive to squid users and not paid ISP proxies? I'm new to working with servers, sorry in advance if this question is very basic.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.