Original: http://zhou123.blog.51cto.com/4355617/840837
The reverse proxy for Nginx is mainly in four aspects:1, url rewrite url rewirte2, reverse proxy reverse proxy and enable caching function3. Load balance4, the installation of Third-party modules to achieve health status detection.The application of some
proxy is to provide the server behind the firewall to Internet users for access. The reverse proxy can also provide load balancing for multiple servers in the backend, or provide buffering services for servers with slower back-end.
In addition, the reverse proxy can enable advanced URL policies and management techniques so that Web pages that are in different We
\ # uses the HTTPS protocol module. By default, the module is not built. It is necessary to establish and run the OpenSSL library for this module. --with-http_realip_module \ # allow Ngx_http_realip_module module (MOD_RPAF) --with-http_addition_module \ #. Module (mod_layout) --with-http_sub_module \ #. Module --with-http_dav_module \ #. Module (MOD_DAV) --with-http_flv_module \ #. (MOD_FLVX) --with-http_mp4_module \ #. Module (mod_mp4) --with-http_g
Because of the need, have to build a Nginx+tomcat+https server, search the discovery of the internet is always wrong, now sorted out some useful, memo.
Environment: Centos6.5, JDK1.8, Tomcat8, Nginx1.10.1
Preparation Material:
1.jdk1.8 installation Package jdk-8u102-linux-x64.tar.gz
2.TOMCAT8 installation Package apache-tomcat-8.0.37.tar.gz
3.NGINX1.10 installation Package
First, Nginx forward and reverse proxy
1, Nginx of the forward agent
The forward proxy is a server located between the client and the original server (Origin server), in order to obtain content from the original server, the client sends a request to the agent and specifies the target (the original server), and the ag
SceneHTTP was used earlier in the project, and HTTPS was enabled for security reasons later.Project Architecture: The front end uses Nginx as the reverse proxy and load balancer for multiple Tomcat instances.In fact, only need to enable HTTPS on the Nginx, so that the client
Nginx Reverse Proxy Server Load balancer page cache URL rewriting and read/write splitting
Outline
I. Preface
II. Environment preparation
3. install and configure Nginx
Iv. reverse proxy for Nginx
5. Load Balancing for Nginx
Nginx function Explanation:1. Reverse proxy: Requires multiple programs to share the 80 port when the use of reverse proxy, Nginx is a reverse proxy implementation.2. Static resource management: generally use Nginx to do reverse
This is actually the same as configuring the HTTP proxy, I did not use the support of the Squid version of SSL, so repeatedly toss does not work!
First have to check if you are using the Squid version is to support SSL, mainly to see if the Squid\sbin\ssleay32.dll file exists, if there is no this file that will have to switch to support the squid version of SSL.
I'll just provide the simplest example here:
Copy Code code as follows:
AC
Resources to use:
Nginx Primary server One, Nginx standby server, use keepalived for downtime switching.
Tomcat server two, by Nginx reverse proxy and load balancing, here can build server cluster.
Redis server, used for session separation and sharing.
Nginx Primary server:
First, Nginx installation
Refer to: Nginx installation configuration
If the Yum installation fails, you can download the relevant RPM package from this place * *, directly perform the install.sh installation
Second, configure HTTP
Modify the configuration file nginx.conf, install the steps above to install, should be in/usr/local/webserver/nginx/conf this directo
The environment is: Windows2003 + nginx. (using the 1.5.10 version, the current version, as recommended by the official documentation.)
A simple configuration, let Nginx first run up
Nginx configuration is relatively simple. conf directory to find the nginx.conf file, modify the following configuration
The code is as follows
Copy Code
x86_64 1.8.0-34.el7 ndeploy 36 MInstalling for dependencies:PyYAML x86_64 3.10-11.el7 base 153 klibevent x86_64 2.0.21-4.el7 base 214 kmemcached x86_64 1.4.15-9.el7 base 84 kpython-inotify noarch 0.9.4-4.el7 base 49 kpython-lxml x86_64 3.2.1-4.el7 base 758 kTransaction Summary========================================================================================Install 2 Packages (+5 Dependent packages)Through the above steps, we have completed the installation of the
automatically jump to 443 port
server_name test.com;
#为一个server {...} Turn on SSL to support
SSL on ;
#指定PEM格式的证书文件
ssl_certificate /etc/nginx/test.pem;
#指定PEM格式的私钥文件
ssl_certificate_key /etc/nginx/test.key;
#让http请求重定向到https请求
error_page 497
Less gossip, the following describes how the enterprise needs to access the application server through HTTPS (one-way or two-way authentication) during the project development process by using the domain name of its own application.
1, the domain name application, this should it people know. Apply for a free, or paid domain name on the Internet. In the process of applying for domain name, bind your enterprise's external IP address.
2. Deploy Apache an
: This article mainly introduces nginx Reverse proxy, dynamic and static request separation, and nginx cache application, as well as using ngx_cache_purge to clear the specified URL. if you are interested in the PHP Tutorial, please refer to it. 1. nginx Reverse proxy config
the default home address for this virtual server. Accesses the defined file sequentially.
CharSet, sets the default encoding format for Web pages.
Access_log, the access log for this virtual server.
Error_log, the error log for this virtual server.
The location context in server is used to configure a collection of processing-specific URIs, which are configured as follows:location / { root /home/nginx; index index.html index.js
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.