: This article mainly introduces how to use nginx to complete reverse proxy and process static file requests. if you are interested in PHP tutorials, refer to it.
There are three main parts: nginx basic installation and use, reverse proxy and static file processing requests.
1. Installation and Use (windows)
First D
When I first came into contact with reverse proxy, I did not understand the meaning of the word. I asked a few people, but I did not know what it meant.
For more information, see.
The term "reverse proxy" should be relative to the word "proxy". The role of
Concept: Apache is responsible for PHP pages, nginx is responsible for static pages such as video files
For a single server, there is only one IP address, so different port numbers are used. Apache listens to port 80 and basically does not need to be changed. You only need to copy the video file to the file under nginx, then, the reverse proxy function is enabled. This module can send
: This article describes how to configure the reverse proxy for nginx181. For more information about PHP tutorials, see.
The previous article introduced how to install nginx1.8.1 and how to use nginx1.8.1 to reverse proxy tomcat.
My environment:
The local machine is the Windows system ip address: 192.168.1.131 tomcat P
: This article mainly introduces the nginx Reverse proxy TCP to fetch the RTMP stream. if you are interested in the PHP Tutorial, refer to it. Nginx Reverse proxy TCP, get RTMP stream
I. descriptionNginx only supports HTTP reverse proxy
forbidden feature2.window.name+iframe requires a target server response Window.name3.HTML5 's postMessage focuses primarily on front-end communications, and data transfer between pages in different domains4.Cors requires server settings header:Access-Control-Allow-Origin5.Nginx reverse proxy can not need the target server mate, but requires Nginx relay server, for forwarding requests (server-side resource
: This article mainly introduces how to use nodejs to replace nginx for reverse proxy. if you are interested in the PHP Tutorial, refer to it.
Var http =Require('Http'), httpProxy =Require('Http-proxy'); // create a proxy Proxy Server object var
Ask for advice !! I love segmentfault. So I refused Baidu. Ask for advice !!
I love segmentfault. So I refused Baidu.
Reply content:
Ask for advice !!I love segmentfault. So I refused Baidu.
In short
Forward Proxy: {client ---> Proxy Server} ---> server.{}Lan
Reverse Proxy: client ---> {
="."5Server="${prefix}/bin/nginx"6std_log="${prefix}/logs/std.log"7err_log="${prefix}/logs/std.log.err"8Exec_user="Root"9 ####################################Ten One if[' whoami '! =${exec_user}]; Then Aecho must use ${exec_user}! -Exit1 - fi the -Killall-9Nginx - -Rm-f logs/Access_log +/sbin/sysctl-w net.ipv4.tcp_timestamps=1 //the TCP timestamp (which increases by 12 bytes in the TCP header) enables the calculation of RTT (round-trip time: round-trip delay) to be enabled with a more precise
The Apache built by RPM is suitable for most applications, it contains most of the modules, and we just use it to build a reverse proxy, too many large modules are not good, affecting performance, so we chose the targeted source code compiled, so that Apache to adapt to our platform.
Download Source code:
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.25.tar.gz
Extract
Tar zxvf httpd-2.2.25.tar.gz
In JSP, the method for obtaining the Client IP address is request. getRemoteAddr (), which is valid in most cases. However, the real IP address of the client cannot be obtained through reverse proxy software such as Apache and Squid.
If reverse proxy software is used, when the URL
Guide
Nginx is one of the fastest and most powerful WEB servers, known for its high performance and low resource usage. It can be installed either as a standalone Web server or as a reverse proxy Web server. In this article, I will discuss installing Nginx as an Apache reverse proxy server on a Centos 7 server wit
SOURCE InstallationGo to nginx official website to download the latest stable version, here is the nginx-1.6.3 version.After the download is complete, unzip and go to the directory to execute:./configureIf you don't have PCER libraries, libraries, etc. on your machine zlib , this step will go wrong.sudo apt-get install libpcre3-dev zlibc zlib-binThen execute:sudo makesudo make installWhen done, Nginx will be installed in the directory by default /usr/local/nginx .Basic configuration of
Obtain the real IP address of the client under multi-level reverse proxy [Squid]
In many applications, you may need to record the real IP address of the user. In this case, you need to obtain the real IP address of the user. In JSP, you can obtain the IP address of the client:Request. getRemoteAddr ()In most cases, this method is effective. However, the real IP address of the client cannot be obtained throu
file:Proxy_redirect off;Proxy_set_header Host $ host;Proxy_set_header X-Real-IP $ remote_addr;Proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;Client_max_body_size 50 m; // maximum number of bytes allowed for client requests per fileClient_body_buffer_size 256 k; // maximum number of bytes requested by the buffer proxy to buffer the clientProxy_connect_timeout 30; // timeout value for connecting to the backend serverProxy_send_timeout 30;
Environment topology650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/B3/wKiom1WC-dzR6QWUAAH2zGcZxyY458.jpg "/>Environment Description:
IP Address
Function description
Nginx or httpd
172.16.4.100
Proxy server, which distributes user requests to the back-end Tomcat server for reverse proxy and load ba
PrefaceYou need to use NGINX's reverse proxy function, the test environment is Centos+nginx 1.8.0.跳过一些繁琐的问题,直接记录核心Steps(1)centos 安装在VM中,因此需要注意网络连接问题(2)安装nginx使用的是具有网络的yum功能(3)配置centos防火墙,需要开启80 端口(4)nginx 反向代理配置(5)性能优化设置(后续工作...)RealizeA. Yum installation NginxAdd Nginx source First, test using the latest Nginx 1.8.0rpm -ivh Execute command:yum install nginxservice nginx startIf not unexpected, in the brow
Nginx has the characteristics of reverse proxy (the difference between note and forward proxy) and load balancing.The Nginx is installed on the 192.168.1.108 Linux machine. Installation Nginx first to install the OpenSSL library,Gcc,pcre,zlib Library and so on . Tomcat is installed on both the 192.168.1.168 and 192.168.1.178 machines. The client accesses the 192.
1. Proxy and reverse proxy server: connection requests from the proxy internal network to the Internet. External access requests to the internal network are not supported. Reverse Proxy Server: acts as a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.