In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How do I forward requests using proxies in Nginx? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Nginx uses proxy to forward request instance
As one of the most popular web servers at present, nginx can easily implement reverse proxy.
Nginx reverse proxy official document: NGINX REVERSE PROXY
When several different web servers are deployed on one host and need to be able to access these web servers at the same time, the reverse proxy function of nginx can be used to use nginx to listen for all requests on port 80 and forward them to port 443.Then port 443 will uniformly forward them to the corresponding domestic web servers according to the forwarding rules.
1. Domestic Beijing Ali Cloud Server (proxy.mimvp.com)
There can be multiple vim mimvp_proxy.confserver {listen 80; server_name proxy.mimvp.com; # domain names, separated by spaces root www/mimvp_proxy; rewrite ^ (. *) $https://$host$1 permanent; location / {root www/mimvp_proxy; index index.php index.html index.htm;} location ~. Php$ {root www/mimvp_proxy Fastcgi_pass 127.0.0.1 location 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / scripts$fastcgi_script_name; include fastcgi.conf;} location ~ * ^ / (images | img | javascript | css | blog | flash | media | static) / {root www/mimvp_proxy; expires 30d;} location ~ * ^ / (robots\ .txt) {root www/mimvp_proxy; expires 365d;} location ~ * ^ / favicon\ .ico {root www/mimvp_proxy Expires 365d;} location ~ * ^ / img/logo\ .png {root www/mimvp_proxy; expires 365d;} location ~ /\ .ht {deny all;}} server {listen 443 ssl http2; server_name proxy.mimvp.com; # domain names can be multiple, separated by spaces Ssl_session_timeout 10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHEMUR location ~\. Php$ {root www/mimvp_proxy; fastcgi_pass 127.0.0.19000 Fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / scripts$fastcgi_script_name; include fastcgi.conf;} location ~ * ^ / (images | img | javascript | js | css | blog | flash | media | static) / {root www/mimvp_proxy; expires 30d;} location ~ * ^ / (robots\ .txt) {root www/mimvp_proxy; expires 365d;} location ~ * ^ / favicon\ .ico {root www/mimvp_proxy; expires 365d } location ~ * ^ / img/logo\ .png {root www/mimvp_proxy; expires 365d;} location ~ /\ .ht {deny all;}}
two。 Overseas Singapore Tencent Cloud Server (proxy.mimgu.cn)
Vim mimvp_proxy2.confserver {listen 80; server_name proxy.mimgu.cn; root www/mimvp_proxy; rewrite ^ (. *) $https://$host$1 permanent; # # all requests are forcibly redirected to https} server {listen 443 ssl http2; server_name proxy.mimgu.cn; root www/mimvp_proxy; ssl on; ssl_certificate proxy.mimgu.cn.crt; ssl_certificate_key proxy.mimgu.cn.key; ssl_session_cache shared:SSL:1m Ssl_session_timeout 10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ssl_prefer_server_ciphers on; location / {proxy_pass https://proxy.mimvp.com;; ssl_prefer_server_ciphers on; location / {ECDHEMUR; ssl_prefer_server_ciphers on; location / {ECDHEMUR / {ECDHEMUR / {ECDHER] # # all requests are forcibly redirected to the domestic server https://proxy.mimvp.com} location ~\. Php$ {proxy_pass https://proxy.mimvp.com;} location * ^ / (images | img | javascript | js | css | blog | flash | media | static) / {proxy_pass https://proxy.mimvp.com; # # all css,js,img must be forcibly forwarded, otherwise typesetting may be mistypesetting} location ~ * ^ / (robots\ .txt) {proxy_pass https://proxy.mimvp.com;} location ~ * ^ / favicon\ .ico {proxy_pass https://proxy.mimvp.com;} location ~ * ^ / img/logo\ .png {proxy_pass https://proxy.mimvp.com;} location ~ /\ .ht {deny all;}}
3. View the effect
Http proxy.mimvp.com / / forcibly redirect to the only domain name URL displayed in https proxy.mimvp.comhttps proxy.mimvp.com / / http proxy.mimgu.cn / / forcibly redirect to https proxy.mimgu.cn, and then continue to forcibly redirect to https proxy.mimvp.comhttps proxy.mimgu.cn / / forcibly redirect to https proxy.mimvp.com. After reading the above, do you know how to use agents to forward requests in Nginx? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.