Home > Operation and Maintenance > Nginx > Benefits of nginx forward proxy

Benefits of nginx forward proxy

(*-*)浩
Release: 2019-06-18 10:59:33
Original
7037 people have browsed it

Forward proxy is our proxy IP in the traditional sense. The general method of use is to configure the proxy IP and port in the browser, and then you can use it. We usually use it for fanqiang or Hide your real IP.

Benefits of nginx forward proxy

Forward proxy working principle

His working principle is like a springboard. Simply put, I am For a user, I cannot access a certain website, but I can access a proxy server. As for this proxy server, he can access the website that I cannot access, so I first connect to the proxy server and tell him that I need the content of the inaccessible website. , the proxy server goes to get it back, and then returns it to me. From the website's perspective, sometimes the real user's request is not known and the user's information is hidden, depending on whether the agent tells the website or not.

The typical use of a forward proxy is to provide access to the Internet for LAN clients within the firewall. Forward proxies can also use caching features (provided by mod_cache) to reduce network usage.

nginx forward proxy server construction and configuration

nignx forward proxy configuration is relatively simple, that is, adding a few lines of parameters to nginx.conf.

server
 {
#指定代理端口 listen 800 ;
 #listen [::]:80 default_server ipv6only=on;
 server_name www.vuln.cn;
 index index.html index.htm index.php;
 root /home/wwwroot/default/;

 #error_page 404 /404.html;
 include enable-php.conf;
#配置dns与代理 location / { 
 resolver 114.114.114.114;
 proxy_pass $scheme://$http_host$request_uri; 
 } 
 location /nginx_status
 {
 stub_status on;
 access_log off;
 }
#解决css与图片加载不出的问题 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$
 {
 resolver 114.114.114.114; 
 proxy_pass $scheme://$http_host$request_uri; 
 proxy_buffers 256 4k; 

 if (-f $request_filename) {

 expires 1d;

 break;

 }
 }
 location ~ .*\.(js|css)?$
 {
 expires 12h;
 }

 location ~/\.
 {
 deny all;
 }
 }
Copy after login

For more Nginx related technical articles, please visit the Nginx Usage Tutorial column to learn!

The above is the detailed content of Benefits of nginx forward proxy. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template