What should I do if I want to access google or other websites that are inaccessible to Tianchao? The premise is that there must be a VPS that is not in the dtplus Lan.
Method 1: Create a vpn. For details, refer to vpn installation and configuration.
Method 2: Set up a proxy server, which will be described in detail below
1. Install squid
# Yum install squid
2. Add the authenticated user test123
# Htpasswd-c/etc/squid/passwd test123
3. Configure proxy and user authentication
# Vim/etc/squid. conf // add the following content
Auth_param basic program/usr/lib64/squid/ncsa_auth/etc/squid/passwd // The authentication method is basic. The Authentication program path and password file path
Auth_param basic children 5 // Number of authenticate processes
Auth_param basic credentialsttl 1 hours // authentication validity period
Auth_param basic realm my test prosy // the content displayed in the enter user/password dialog box is displayed in the browser
Acl test123 proxy_auth REQUIRED
Http_access allow test123 // normal users must pass authentication before accessing
4. Open the firewall Port
# Iptables-a input-p tcp-m state -- state NEW-m tcp -- dport 3128-j ACCEPT // squid default port, 3128
5. Restart squid.
#/Etc/init. d/squid restart
In this way, the squid proxy is ready. Set the proxy IP address and port in the browser. The authentication box is displayed. Enter the user name and password.
6. php can also use the proxy server
Function testCurl ($ url ){
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, $ gurl );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_HTTPPROXYTUNNEL, TRUE );
Curl_setopt ($ ch, CURLOPT_PROXY, "23. 220. *. *: 3128"); // ip/Port
Curl_setopt ($ ch, CURLOPT_PROXYUSERPWD, 'test123: 123456 '); // authenticate the user and password
$ Result = curl_exec ($ ch );
Curl_close ($ ch );
Return $ result;
}
Echo testCurl ("google.com ");