Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nginx specification

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

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

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report