Nginx because of its efficient concurrency processing capacity, and began to be more and more people accept and recognition, now many sites have been completely replaced by Nginx Apache to deal with static pages, but the dynamic page of the area, Apache has its own unique.
Below what is the reverse proxy, and why the reverse proxy. According to the Encyclopedia: Reverse proxy (Reverse proxy) means to accept a connection request on the Internet with a proxy server, then forward the request to a server on the internal network and return the results from the server to the client requesting the connection on the Internet, At this point, the proxy server behaves as a server. Concise point, according to my understanding, the reverse proxy is a server responsible for receiving the request of the extranet, but they do not deal with, but to tell other intranet server to deal with, and the results of the treatment of others returned to the user. From the user's point of view, the request is the proxy server to deal with, in fact, he is forwarding a bit, return the results of others.
So what is the effect of using a reverse proxy? According to Wikipedia, you can provide an encrypted connection from the external proxy server of the firewall to the Secure Content server inside the firewall. You can allow clients to securely connect to a proxy server, which facilitates the safe transmission of information, such as credit card numbers. A secure reverse proxy causes each secure connection to slow down because of the overhead involved in encrypting the data. However, because SSL provides a caching mechanism, both parties can reuse previously negotiated security parameters, significantly reducing the overhead of subsequent connections. To be easy to understand means: one is safe, one is to increase the cost of the system to a certain extent.
Here is how to do the reverse proxy, here to give you an example, interested can test their own.
First install Nginx and bind to port 80, install Apache binding listening to port 8080. Then set the Nginx Server directory for the Www_nginx,apache server directory for Www_apache, respectively, in 2 directories to create a index.html file, which is written on the nginx,apache2 word is sufficient. We then configure the Nginx configuration file, typically nginx.conf this file, to modify the configuration information inside. Location/{Proxy_pass 127.0.0.1:8080} start Nginx and Apache at the same time, when you visit 127.0.0.1, you will find a magical thing, the output of Apache, Obviously Nginx server directory there is no output, but Apache, that is because the nginx to the reverse proxy, to find Apache listening to 8080 ports to content, and then Apache returned to him after processing results. This is a simple example, in fact, we can let Nginx processing static pages, processing pictures, CSS, JS and other files, and let Apache process dynamic files. For example, we can modify this:
Location ~ \.php$ {
Proxy_pass 127.0.0.1:8080;
This is only a PHP file to the Apache processing, the others or nginx to deal with.