In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
We have used nginx to set up a forward proxy when introducing nginx, but if we want to support https, it is more difficult to use nginx directly, while it is much easier to use squid which specializes in this area. This article is used to document the steps to install and set up squid3.5 on centos7 to implement http and https.
Machine configuration
[root@liumiaocn ~] # uname-aLinux mail.163.com 3.10.0-514.el7.x86_64 # 1 SMP Tue Nov 22 16:42:41 UTC 2016 x 86 "64 GNU/Linux [root@liumiaocn ~] # [root@liumiaocn ~] # cat / etc/redhat-release CentOS Linux release 7.3.1611 (Core) [root@liumiaocn ~] #
Install squid
Installation command: yum install squid
Confirm the version
Version confirmation: rpm-qa | grep squid
[root@liumiaocn ~] # rpm-qa | grep squidsquid-migration-script-3.5.20-12.el7.x86_64squid-3.5.20-12.el7.x86_64 [root@liumiaocn ~] #
Confirm ip_forward
Ip_forward needs to be set to 1. The default centos has been set. Details are as follows:
[root@liumiaocn ~] # sysctl-a | grep-w ip_forwardnet.ipv4.ip_forward = 1 [root@liumiaocn ~] #
Modify the settings file
Before modification
[root@liumiaocn ~] # grep-n 'http_access deny all' / etc/squid/squid.conf56:http_access deny all [root@liumiaocn ~] #
After modification
[root@liumiaocn ~] # grep-n http / etc/squid/squid.conf | grep-w all56:http_access allow all [root@liumiaocn ~] #
Start squid
Systemctl start squid
Problem 1:libssl error
The following error is prompted when starting squid
Squid: relocation error: squid: symbol SSL_set_alpn_protos, version libssl.so.10 not defined in file libssl.so.10 with link time reference
Reason: openssl is not installed
Corresponding method: yum install openssl
After installation, start squid:
[root@liumiaocn ~] # systemctl start squid [root@liumiaocn ~] # systemctl status squid ● squid.service-Squid caching proxy Loaded: loaded (/ usr/lib/systemd/system/squid.service; disabled; vendor preset: disabled) Active: active (running) since Tue 2018-06-05 20:07:56 CST 8s ago Process: 28548 ExecStart=/usr/sbin/squid $SQUID_OPTS-f $SQUID_CONF (code=exited, status=0/SUCCESS) Process: 28540 ExecStartPre=/usr/libexec/squid/cache_swap.sh (code=exited Status=0/SUCCESS) Main PID: 28551 (squid) Memory: 14.3M CGroup: / system.slice/squid.service ├─ 28551 / usr/sbin/squid-f / etc/squid/squid.conf ├─ 28553 (squid-1)-f / etc/squid/squid.conf └─ 28557 (logfile-daemon) / var/log/squid/access.logJun 05 20:07:56 liumiaocn systemd [1]: Starting Squid caching proxy...Jun 05 20:07:56 Liumiaocn squid [28551]: Squid Parent: will start 1 kidsJun 05 20:07:56 liumiaocn squid [28551]: Squid Parent: (squid-1) process 28553 startedJun 05 20:07:56 liumiaocn systemd [1]: Started Squid caching proxy. [root@liumiaocn ~] #
Problem 2: unable to resolve domain name
At this point, it is found that the domain name cannot be used and can only be accessed using ip.
Reason: dns is not configured, add 8.8.8.8 and 8.8.4.4 to the configuration file of squid
[root@liumiaocn ~] # grep nameserver / etc/squid/squid.confdns_nameservers 8.8.8.8 8.8.4.4 [root@liumiaocn] # [root@liumiaocn ~] # systemctl restart squid [root@liumiaocn ~] #
Client access
The default port of squid is 3128, which is not modified here. You can access it on the client using the following ways:
Http mode
Export http_proxy= http://192.168.163.117:3128
Curl http://www.baidu.com
Https mode
Export https_proxy= http://192.168.163.117:3128
Curl https://www.baidu.com
Summary
The above is the whole content of this article. I hope the content of this article has a certain reference and learning value for everyone's study or work. Thank you for your support. If you want to know more about it, please see the relevant links below.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.