Get the App
SLTechnology News&Howtos  ›  Servers  › 

Nginx specification

Shulou Source: shulou.com Published: 2022-06-03 09:56:06 12月06日 Update

Nginx Architecture-Nginx+tomcat

Tomcat itself is a web server, which can handle requests for static files, but its processing capacity is not as strong as that of Nginx, so it is necessary to do a static and dynamic separation.

In this architecture, Nginx directly proxies Tomcat

Tomcat installation strategy

Profile exampl

Https://coding.net/u/aminglinux/p/nginx/git/blob/master/java/nginx_tomcat.md

Profile exampl

Server

{

Listen 80

Server_name www.aminglinux.com

Location ~ * "\. (jpg | png | jepg | js | css | xml | bmp | swf | gif | html) $" {root/ data/wwwroot/aminglinux/; access_log off; expire 7d;} location / {proxy_pass http://127.0.0.1:8080/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}

}

Description:

First of all, the requests for various static files are separated and processed separately by nginx.

2 other requests directly proxy port 8080, that is, tomcat service.

The architecture of nginx and tomcat is shown below

Nginx Architecture-Nginx+keepalived

Users access one vip (virtual IP), and two Nginx achieve high availability through Keepalived

Normally, the Nginx master provides the service, while the Nginx backup does not provide the service, leaving it as a backup. When the master down is dropped, the Nginx backup will provide the service instead of the master.

Both Nginx master and slave should be configured with load balancer, and all Server of proxy backend should be configured.

In this architecture, Nginx and Keepalived are installed on the same machine, which means that both the Nginx master and the Nginx backup need to install the Keepalived service

Nginx to achieve requested load balancing + keepalived to achieve high availability of nginx

Https://blog.51cto.com/865516915/2149773

Installation, upgrade (yum installation or source code installation, compilation parameters, installation path, etc.)

Service management (startup script, restart, reload, startup user)

Configuration specification

Log format, path, naming rules, and cutting strategy

Pid path

Virtual host (default virtual host, virtual host independent)

Static file log and expiration cache time

Hotlink protection

Change the configuration (use the automation tool to change the profile)

Safety specification

Background address plus user authentication

Writable directory forbids parsing php

Disable access to .bak files

Tags: Files services configuration architecture hosts users virtual hosts paths static proxies processing balancing examples security that is movement parameters background address Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Huawei Apple Shulou Tech Info macOS