WebApp dynamic proxy system based on Nginx

By designing a WebApp dynamic proxy system based on Nginx in a cloud network environment, using the Nginx proxy module, WebApp management platform and configuration refresh module, a dynamic proxy of multiple WebApps with a single IP and port is realized, solving the complicated configuration in the existing technology and the high cost issue improves the flexibility and scalability of the system.

CN118945031AActive Publication Date: 2024-11-12SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411056191.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2024-11-12
Estimated Expiration
2044-08-02

AI Technical Summary

Technical Problem

In a cloud network environment, when using Nginx reverse proxy, it is cumbersome to manage the proxy configuration of multiple business systems, and it is difficult to implement dynamic proxying of multiple WebApps with a single IP and port, resulting in high usage and operation and maintenance costs.

Method used

Design a dynamic proxy system for WebApp based on Nginx, including Nginx proxy module, WebApp management platform and configuration refresh module. It realizes proxying of multiple WebApps through a single IP and port, and uses the WebApp management platform to generate unique identifiers and automatically update Nginx configurations. , supports hot loading and timed refresh.

Benefits of technology

It realizes dynamic proxying of multiple WebApps through a single IP and port, reducing usage and operation costs, simplifying network architecture, improving system flexibility and scalability, and reducing administrator operation complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118945031A_ABST
    Figure CN118945031A_ABST
Patent Text Reader

Abstract

The invention discloses a WebApp dynamic proxy system based on Nginx, belongs to the technical field of software development, and aims to solve the technical problem of how to realize proxy of a plurality of WebApp by a single IP (Internet Protocol) and a port based on Nginx reverse proxy so as to reduce the use cost and the operation and maintenance cost. Comprising an Nginx agent module, a WebApp management platform and a configuration refreshing module, the Nginx agent module is deployed on a server capable of public access, and provides default configuration of an Nginx agent and template configuration of WebAPP access; the WebApp management platform interacts with an administrator through the WebApp management interface, and provides a login authentication service of the WebApp and a management operation of the WebApp through the WebApp management interface; and the configuration refreshing module is used for providing an addition and deletion service of a configuration file of the Nginx proxy module and a hot loading operation of the Nginx proxy application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, in particular to a WebApp dynamic proxy system based on Nginx. Background Art

[0002] In some cloud network environments, publicly accessible IPs and ports may be fixed. If an uncertain number of business systems need to be accessed, Nginx is generally required for reverse proxy. When using Nginx reverse proxy, you don't need to pay attention to the real address of the business system. You only need to ensure that the Nginx reverse proxy server and the business information network are reachable. It also supports load balancing, caching and other functions. However, reverse proxies generally achieve their ultimate goal by listening to different ports or using different location blocks. If only one port can be listened to, and there is no clear context distinction between different business systems, it is necessary to implement it through request headers, client IP, server_name, etc., which is more cumbersome, and each time a new business system is connected or exited, cumbersome configuration is required, which fails to achieve the purpose of dynamic proxy.

[0003] How to use Nginx's reverse proxy to proxy multiple WebApps with a single IP and port to reduce usage costs and operation and maintenance costs is a technical problem that needs to be solved. Summary of the invention

[0004] The technical task of the present invention is to provide a WebApp dynamic proxy system based on Nginx to address the above shortcomings, so as to solve the technical problem of how to use a single IP and port to proxy multiple WebApps based on Nginx's reverse proxy to reduce the cost of use and operation and maintenance costs.

[0005] The present invention discloses a WebApp dynamic proxy system based on Nginx, which is used to realize proxy services for multiple business system WebAPPs through one IP and port. The system includes an Nginx proxy module, a WebApp management platform and a configuration refresh module;

[0006] The Nginx proxy module is deployed on a publicly accessible server to provide the default configuration of the Nginx proxy and the template configuration for WebAPP access;

[0007] The WebApp management platform interacts with the administrator through the WebAPP management interface, and provides WebAPP login authentication services and WebAPP management operations through the WebAPP management interface. WebAPP management operations include WebAPP access, exit, add, modify and delete operations, which are used to generate a unique identifier server_name for the accessed WebAPP, and to form and display the WebAPP list and the Web application of each WebAPP;

[0008] The configuration refresh module is used to provide the addition and deletion services of the Nginx proxy module configuration files and the hot loading operation of the Ngeinx proxy application.

[0009] Preferably, the Nginx proxy module installs or starts the Nginx service by means of an rpm package or a docker image, and supports the http protocol.

[0010] Preferably, the default configuration of the Nginx proxy includes:

[0011] Modify the Nginx default configuration file and reference all conf files in the / etc / nginx / conf.d / directory;

[0012] Set a unique listening port. If you need to set a certificate to listen to the https port, the certificate can be configured as a self-signed certificate.

[0013] The server_name cannot be empty. If it is empty, 403Forbidden is returned.

[0014] The server_name must exist. If a non-existent server_name is encountered, 403 Forbidden is returned.

[0015] Preferably, the Nginx proxy module supports the template configuration of WebAPP, including:

[0016] Create a new template file conf.template, the content of which is the listening service for the only port;

[0017] Set the server_name, certificate, private key, and proxy_pass values ​​of the WebAPP to the corresponding placeholders #server_name#, #server.crt#, #server.key#, and #proxy_pass#.

[0018] Preferably, for the new addition operation of WebAPP, the WebApp management platform is used to perform the following:

[0019] Persist the application code of WebAPP, WebAPP, actual access address proxy_pass, certificate server.crt and private key server.key to the database. The application code cannot be repeated.

[0020] The backend service calculates the hash value of the application code as the prefix of server_name, and concatenates the hash of the application code with the default domain name string provided by WebAPP to form server_name.

[0021] If proxy_pass is the https service address, the certificate and private key of the WebApp to be accessed are used for login authentication, or the default certificate and private key are used. Finally, the certificate and private key are persisted to the specified directory of the Nginx proxy module server.

[0022] Persist the WebAPP application code uuid, server_name, certificate server_crt, private key server_key, deletion status is_deleted, and data update timestamp updated_time to the database web_app table.

[0023] Preferably, for the modification operation of the WebAPP, the WebApp management platform is used to modify the application code based on the WebAPP, and the application code of the WebAPP cannot be modified;

[0024] If the WebApp management platform is accessed as a WebAPP, the WebApp management platform cannot be modified or deleted.

[0025] Preferably, for the deletion operation of WebAPP, the WebApp management platform is used to soft-delete the data corresponding to WebAPP persisted in the database based on the application code, and the soft deletion method is: do not directly delete the data, modify the is_deleted value of the data to true, and record the modification time of the data.

[0026] Preferably, for the query operation of WebAPP, the WebApp management platform is used to query the connected WebApp based on the WebAPP list, and read and display the WebApp table data persisted in the database based on the server_name of the WebAPP.

[0027] Preferably, the configuration refresh module is used to perform the following operations:

[0028] Scheduled scanning of WebAPP table: Get the timestamp of the last execution of the scheduled task from the cache and compare it with the modification time of the WebApp table data. If the modification time is later than the timestamp of the last execution of the scheduled task, the Nginx configuration update operation is incrementally performed. If the scheduled task is executed for the first time, the timestamp of the last execution is empty, and the Nginx configuration update operation is fully performed. According to the scanned data, whether is_deleted is true, execute the next step;

[0029] When the data is_deleted value is false, it means that the configuration is added or modified. A configuration file with the file name #server_name# and the suffix conf is generated according to the template file conf.template, and the placeholders #server_name#, #proxy_pass#, #server.crt#, and #server.key# are replaced with the actual values ​​stored in the database. It is determined whether there is a file with the same name in the / etc / nginx / conf.d / directory. If there is no file with the same name in the directory, it means that the configuration is added. The generated file is directly copied to the / etc / nginx / conf.d / directory. If there is a file with the same name in the directory, it means that it is an update operation. The file with the same name is deleted before the copy operation is performed; when the data status is soft deleted, it means that the configuration is deleted. The file with the file name #server_name# and the suffix conf in the / etc / nginx / conf.d / directory of the server where the Nginx proxy module is located is deleted;

[0030] Execute the nginx-s reload hot update command to refresh the Nginx configuration and make it take effect immediately;

[0031] The soft-deleted server_name information in the Nginx proxy configuration has been cleared, and the data in the WebApp table needs to be cleared synchronously;

[0032] The timestamp of this scheduled task refresh is recorded in the cache for use in the next execution.

[0033] The Nginx-based WebApp dynamic proxy system of the present invention has the following advantages:

[0034] 1. By utilizing Nginx reverse proxy technology and combining it with a visual operation interface, dynamic proxy access to an uncertain number of business systems can be achieved through a fixed IP and port that can be accessed by the public, which greatly reduces the cost of use and operation and maintenance, and provides an efficient and flexible solution for business expansion and management in a cloud environment;

[0035] 2. Through a single publicly accessible IP address and port, proxy services for multiple WebApps are realized. Users do not need to allocate independent IP and port for each WebApp, thus simplifying the network architecture and reducing resource consumption;

[0036] 3. Through the WebApp management interface, administrators can quickly generate a unique server_name for each business system. These server_names will become part of the Nginx configuration and are used to identify and proxy the corresponding business systems. The function of quickly generating server_names greatly reduces the administrator's manual operations and improves work efficiency. Using server_name as a key identifier to distinguish different WebApps ensures that requests can be accurately forwarded to the target business system.

[0037] 4. When a new business system needs to be connected, the administrator only needs to add the corresponding WebApp, without manually modifying the Nginx configuration or restarting the Nginx service, and it will take effect immediately. Similarly, when a business system needs to be exited, the administrator only needs to delete the corresponding WebApp from the WebApp management interface, and the configuration will be automatically updated and the business system will no longer be represented. This fast access and exit mechanism enables the system to flexibly adapt to business changes and improves the scalability and flexibility of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0039] The present invention is further described below in conjunction with the accompanying drawings.

[0040] Figure 1 A working block diagram of a WebApp dynamic proxy system based on Nginx is provided as an embodiment;

[0041] Figure 2 A schematic diagram of the default configuration of Nginx in a WebApp dynamic proxy system based on Nginx is provided as an example;

[0042] Figure 3 A schematic diagram of a WebApp access template in a WebApp dynamic proxy system based on Nginx is provided in accordance with an embodiment of the present invention;

[0043] Figure 4 The present invention is a schematic diagram of an example of WebApp table data in a WebApp dynamic proxy system based on Nginx according to an embodiment of the present invention. DETAILED DESCRIPTION

[0044] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it. However, the embodiments are not intended to limit the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments may be combined with each other.

[0045] The present invention discloses a WebApp dynamic proxy system based on Nginx, which is used to realize proxy services for multiple business system WebAPPs through one IP and port. The system includes an Nginx proxy module, a WebApp management platform and a configuration refresh module;

[0046] The Nginx proxy module is deployed on a publicly accessible server to provide the default configuration of the Nginx proxy and the template configuration for WebAPP access;

[0047] The WebApp management platform interacts with the administrator through the WebAPP management interface, and provides WebAPP login authentication services and WebAPP management operations through the WebAPP management interface. WebAPP management operations include WebAPP access, exit, add, modify and delete operations, which are used to generate a unique identifier server_name for the accessed WebAPP, and to form and display the WebAPP list and the Web application of each WebAPP;

[0048] The configuration refresh module is used to provide the addition and deletion services of the Nginx proxy module configuration files and the hot loading operation of the Ngeinx proxy application.

[0049] Preferably, the Nginx proxy module installs or starts the Nginx service by means of an rpm package or a docker image, and supports the http protocol.

[0050] Preferably, the default configuration of the Nginx proxy includes:

[0051] Modify the Nginx default configuration file and reference all conf files in the / etc / nginx / conf.d / directory;

[0052] Set a unique listening port. If you need to set a certificate to listen to the https port, the certificate can be configured as a self-signed certificate.

[0053] The server_name cannot be empty. If it is empty, 403Forbidden is returned.

[0054] The server_name must exist. If a non-existent server_name is encountered, 403 Forbidden is returned.

[0055] Preferably, the Nginx proxy module supports the template configuration of WebAPP, including:

[0056] Create a new template file conf.template, the content of which is the listening service for the only port;

[0057] Set the server_name, certificate, private key, and proxy_pass values ​​of the WebAPP to the corresponding placeholders #server_name#, #server.crt#, #server.key#, and #proxy_pass#.

[0058] Preferably, for the new addition operation of WebAPP, the WebApp management platform is used to perform the following:

[0059] Persist the application code of WebAPP, WebAPP, actual access address proxy_pass, certificate server.crt and private key server.key to the database. The application code cannot be repeated.

[0060] The backend service calculates the hash value of the application code as the prefix of server_name, and concatenates the hash of the application code with the default domain name string provided by WebAPP to form server_name.

[0061] If proxy_pass is the https service address, the certificate and private key of the WebApp to be accessed are used for login authentication, or the default certificate and private key are used. Finally, the certificate and private key are persisted to the specified directory of the Nginx proxy module server.

[0062] Persist the WebAPP application code uuid, server_name, certificate server_crt, private key server_key, deletion status is_deleted, and data update timestamp updated_time to the database web_app table.

[0063] Preferably, for the modification operation of the WebAPP, the WebApp management platform is used to modify the application code based on the WebAPP, and the application code of the WebAPP cannot be modified;

[0064] If the WebApp management platform is accessed as a WebAPP, the WebApp management platform cannot be modified or deleted.

[0065] Preferably, for the deletion operation of WebAPP, the WebApp management platform is used to soft-delete the data corresponding to WebAPP persisted in the database based on the application code, and the soft deletion method is: do not directly delete the data, modify the is_deleted value of the data to true, and record the modification time of the data.

[0066] Preferably, for the query operation of WebAPP, the WebApp management platform is used to query the connected WebApp based on the WebAPP list, and read and display the WebApp table data persisted in the database based on the server_name of the WebAPP.

[0067] Preferably, the configuration refresh module is used to perform the following operations:

[0068] Scheduled scanning of WebAPP table: Get the timestamp of the last execution of the scheduled task from the cache and compare it with the modification time of the WebApp table data. If the modification time is later than the timestamp of the last execution of the scheduled task, the Nginx configuration update operation is incrementally performed. If the scheduled task is executed for the first time, the timestamp of the last execution is empty, and the Nginx configuration update operation is fully performed. According to the scanned data, whether is_deleted is true, execute the next step;

[0069] When the data is_deleted value is false, it means that the configuration is added or modified. A configuration file with the file name #server_name# and the suffix conf is generated according to the template file conf.template, and the placeholders #server_name#, #proxy_pass#, #server.crt#, and #server.key# are replaced with the actual values ​​stored in the database. It is determined whether there is a file with the same name in the / etc / nginx / conf.d / directory. If there is no file with the same name in the directory, it means that the configuration is added. The generated file is directly copied to the / etc / nginx / conf.d / directory. If there is a file with the same name in the directory, it means that it is an update operation. The file with the same name is deleted before the copy operation is performed; when the data status is soft deleted, it means that the configuration is deleted. The file with the file name #server_name# and the suffix conf in the / etc / nginx / conf.d / directory of the server where the Nginx proxy module is located is deleted;

[0070] Execute the nginx-s reload hot update command to refresh the Nginx configuration and make it take effect immediately;

[0071] The soft-deleted server_name information in the Nginx proxy configuration has been cleared, and the data in the WebApp table needs to be cleared synchronously;

[0072] The timestamp of this scheduled task refresh is recorded in the cache for use in the next execution.

[0073] The embodiment of the present invention provides a WebApp dynamic proxy system based on Nginx, which is used to solve the technical problem of how to use a single IP and port to proxy multiple WebApps based on Nginx reverse proxy to reduce usage cost and operation and maintenance cost.

[0074] Embodiment 1:

[0075] The invention discloses a WebApp dynamic proxy system based on Nginx, which is used for realizing proxy service for multiple business system WebAPPs through one IP and port. The system comprises an Nginx proxy module, a WebApp management platform and a configuration refresh module.

[0076] The Nginx proxy module is deployed on a publicly accessible server to provide the default configuration of the Nginx proxy and the template configuration for WebAPP access.

[0077] In this embodiment, the Nginx service installed or started by using rpm package, docker image, etc. is deployed on a publicly accessible server to ensure that it is reachable with the WebApp network that needs to be accessed later. This Nginx proxy module is mainly for the seven-layer proxy (http protocol).

[0078] The default configuration of Nginx proxy includes:

[0079] (1) Modify the Nginx default configuration file and reference all conf files in the / etc / nginx / conf.d / directory;

[0080] (2) Set a unique listening port. If you need to set a certificate to listen to the https port, the certificate can be configured as a self-signed certificate.

[0081] (3) The server_name cannot be empty. If it is empty, 403 Forbidden is returned.

[0082] (4) The server_name must exist. If a non-existent server_name is encountered, 403 Forbidden is returned.

[0083] Specific configuration example Figure 2 shown.

[0084] The Nginx proxy module in this embodiment provides a template configuration for WebApp access. The template configuration is mainly manifested as follows:

[0085] (1) Create a new template file conf.template, whose content is the listening server for the only port.

[0086] (2) Set the server_name, certificate, private key, and proxy_pass values ​​to the corresponding placeholders #server_name#, #server.crt#, #server.key#, and #proxy_pass#.

[0087] The WebApp management platform interacts with the administrator through the WebAPP management interface, and provides WebAPP login authentication services and WebAPP management operations through the WebAPP management interface. WebAPP management operations include WebAPP access, exit, addition, modification and deletion operations, which are used to generate a unique identifier server_name for the accessed WebAPP, which is used to form and display the WebAPP list and the Web application of each WebAPP.

[0088] In this embodiment, if public access is required, the WebApp management module and the Nginx proxy module are deployed on the same server, and the WebApp itself is also used as a WebApp. The administrator can quickly access and exit the WebApp through the WebApp management platform, so it can only be used after login authentication is passed, and it should have high security.

[0089] The WebApp management platform provides a visual operation interface for WebApp access and exit, mainly providing add, modify, delete and query operations for WebApp.

[0090] For new operations of WebAPP, the WebApp management platform is used to perform the following:

[0091] (1) Store the WebAPP application code, WebAPP, actual access address proxy_pass, certificate server.crt, and private key server.key in the database. The application code cannot be repeated.

[0092] (2) The backend service calculates the hash value of the application code as the prefix of server_name, and concatenates the hash value of the application code with the default domain name string provided by WebAPP to form server_name.

[0093] (3) If proxy_pass is the https service address, the certificate and private key of the WebApp to be accessed are used during login authentication, or the default certificate and private key are used. Finally, the certificate and private key are persisted to the specified directory of the Nginx proxy module server;

[0094] (4) The WebAPP application code uuid, server_name, certificate server_crt, private key server_key, deletion status is_deleted, and data update timestamp updated_time are persisted to the database web_app table.

[0095] For the modification operation of WebAPP, the WebApp management platform is used to modify the application code based on the WebAPP, and the application code of the WebAPP cannot be modified, and the other items can be modified. After the data is modified, the modification time of the data needs to be recorded. If the WebApp management platform is accessed as a WebAPP, the WebApp management platform cannot be modified or deleted.

[0096] For WebAPP deletion operations, the WebApp management platform is used to soft-delete the data corresponding to the WebAPP that is persisted in the database based on the application code. The soft deletion method is: do not delete the data directly, but modify the is_deleted value of the data to true, and record the modification time of the data.

[0097] For WebAPP query operations, the WebApp management platform is used to query the connected WebApp based on the WebAPP list, and read and display the WebApp table data persisted in the database based on the server_name of the WebAPP.

[0098] The WebApp management platform displays the WebApp table data condition query list. The administrator can quickly review and modify the access WebApp through the list data, and provide the server_name of the specified WebApp to the user. If the server_name does not have a domain name resolution, the user can configure the local hosts file.

[0099] The configuration refresh module is used to provide the addition and deletion services of the Nginx proxy module configuration files and the hot loading operations of the Ngeinx proxy applications.

[0100] The scheduled task of the configuration refresh module is used to incrementally refresh the Nginx configuration. Because it is mainly used to add and delete Nginx proxy module configuration files and hot load Nginx, it is best to deploy it on the same server as the Nginx proxy module.

[0101] In this embodiment, the configuration refresh module provides functions such as scheduled scanning, Nginx configuration update, Nginx hot loading, WebApp soft deletion data cleaning, etc. The specific operations are as follows:

[0102] Do the following:

[0103] (1) Scheduled scanning of the WebAPP table: Obtain the timestamp of the last execution of the scheduled task from the cache and compare it with the modification time of the WebApp table data. If the modification time is later than the timestamp of the last execution of the scheduled task, the Nginx configuration update operation is incrementally executed. If the scheduled task is executed for the first time, the timestamp of the last execution is empty, and the Nginx configuration update operation is fully executed. Based on the scanned data, whether is_deleted is true, the next step is executed;

[0104] (2) When the data is_deleted value is false, it means that the configuration is added or modified. A configuration file with the file name #server_name# and the suffix conf is generated according to the template file conf.template, and the placeholders #server_name#, #proxy_pass#, #server.crt#, and #server.key# are replaced with the actual values ​​stored in the database. It is determined whether there is a file with the same name in the / etc / nginx / conf.d / directory. If there is no file with the same name in the directory, it means that the configuration is added. The generated file is directly copied to the / etc / nginx / conf.d / directory. If there is a file with the same name in the directory, it means that the operation is updated. The file with the same name is deleted before the copy operation is performed. When the data status is soft deleted, it means that the configuration is deleted. The file with the file name #server_name# and the suffix conf in the / etc / nginx / conf.d / directory of the server where the Nginx proxy module is located is deleted.

[0105] (3) Execute the nginx-s reload hot update command to refresh the Nginx configuration and make it take effect immediately;

[0106] (4) The soft-deleted server_name information in the Nginx proxy configuration has been cleared, and the data in the WebApp table needs to be cleared synchronously;

[0107] (5) The timestamp of the refresh of this scheduled task is recorded in the cache for use in the next execution.

[0108] Based on the above operations (1)-(5), a configuration refresh operation is completed.

[0109] The system of this embodiment implements proxy services for multiple WebApps through a single publicly accessible IP address and port. Users do not need to allocate independent IP and port to each WebApp, thereby simplifying the network architecture and reducing resource consumption.

[0110] The present invention has been shown and described in detail above through the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above multiple embodiments, those skilled in the art can know that the means in the above different embodiments can be combined to obtain more embodiments of the present invention, and these embodiments are also within the protection scope of the present invention.

Claims

1. A WebApp dynamic proxy system based on Nginx, characterized in that: Used to implement proxy services for multiple business system WebAPPs through one IP and port, the system includes an Nginx proxy module, a WebApp management platform, and a configuration refresh module; The Nginx proxy module is deployed on a publicly accessible server to provide the default configuration of the Nginx proxy and the template configuration for WebAPP access; The WebApp management platform interacts with the administrator through the WebAPP management interface, and provides WebAPP login authentication services and WebAPP management operations through the WebAPP management interface. WebAPP management operations include WebAPP access, exit, add, modify and delete operations, which are used to generate a unique identifier server_name for the accessed WebAPP, and to form and display the WebAPP list and the Web application of each WebAPP; The configuration refresh module is used to provide the addition and deletion services of the Nginx proxy module configuration files and the hot loading operation of the Ngeinx proxy application.

2. According to the Nginx-based WebApp dynamic proxy system of claim 1, it is characterized in that: The Nginx proxy module installs or starts the Nginx service through the rpm package or docker image, and supports the http protocol.

3. The Nginx-based WebApp dynamic proxy system according to claim 1 or 2, characterized in that: The default configuration of the Nginx proxy includes: Modify the Nginx default configuration file and reference all conf files in the / etc / nginx / conf.d / directory; Set a unique listening port. If you need to set a certificate to listen to the https port, the certificate can be configured as a self-signed certificate. The server_name cannot be empty. If it is empty, 403Forbidden is returned. The server_name must exist. If a non-existent server_name is encountered, 403 Forbidden is returned.

4. The Nginx-based WebApp dynamic proxy system according to claim 3, characterized in that: The Nginx proxy module supports template configuration of WebAPP, including: Create a new template file conf.template, the content of which is the listening service for the only port; Set the server_name, certificate, private key, and proxy_pass values ​​of the WebAPP to the corresponding placeholders #server_name#, #server.crt#, #server.key#, and #proxy_pass#.

5. The Nginx-based WebApp dynamic proxy system according to claim 4, characterized in that: For the new operations of WebAPP, the WebApp management platform is used to perform the following: Persist the application code of WebAPP, WebAPP, actual access address proxy_pass, certificate server.crt and private key server.key to the database. The application code cannot be repeated. The backend service calculates the hash value of the application code as the prefix of server_name, and concatenates the hash of the application code with the default domain name string provided by WebAPP to form server_name. If proxy_pass is the https service address, the certificate and private key of the WebApp to be accessed are used for login authentication, or the default certificate and private key are used. Finally, the certificate and private key are persisted to the specified directory of the Nginx proxy module server. The WebAPP application code uuid, server_name, certificate server_crt, private key server_key, deletion status is_deleted, and data update timestamp updated_time are persisted to the database web_app table.

6. The Nginx-based WebApp dynamic proxy system according to claim 5, characterized in that: For the modification operation of WebAPP, the WebApp management platform is used to modify the application code based on the WebAPP, and the application code of the WebAPP cannot be modified; If the WebApp management platform is accessed as a WebAPP, the WebApp management platform cannot be modified or deleted.

7. The Nginx-based WebApp dynamic proxy system according to claim 5, characterized in that: For the deletion operation of WebAPP, the WebApp management platform is used to soft-delete the data corresponding to WebAPP and persisted in the database based on the application code. The soft deletion method is: do not directly delete the data, modify the is_deleted value of the data to true, and record the modification time of the data.

8. The Nginx-based WebApp dynamic proxy system according to claim 5, characterized in that: For the query operation of WebAPP, the WebApp management platform is used to query the connected WebApp based on the WebAPP list, and read and display the WebApp table data persisted in the database based on the server_name of the WebAPP.

9. The Nginx-based WebApp dynamic proxy system according to claim 5, characterized in that: The configuration refresh module is used to perform the following operations: Scheduled scanning of WebAPP table: Get the timestamp of the last execution of the scheduled task from the cache and compare it with the modification time of the WebApp table data. If the modification time is later than the timestamp of the last execution of the scheduled task, the Nginx configuration update operation is incrementally performed. If the scheduled task is executed for the first time, the timestamp of the last execution is empty, and the Nginx configuration update operation is fully performed. According to the scanned data, whether is_deleted is true, execute the next step; When the data is_deleted value is false, it means that the configuration is added or modified. A configuration file with the file name #server_name# and the suffix conf is generated according to the template file conf.template, and the placeholders #server_name#, #proxy_pass#, #server.crt#, and #server.key# are replaced with the actual values ​​stored in the database. It is determined whether there is a file with the same name in the / etc / nginx / conf.d / directory. If there is no file with the same name in the directory, it means that the configuration is added. The generated file is directly copied to the / etc / nginx / conf.d / directory. If there is a file with the same name in the directory, it means that it is an update operation. The file with the same name is deleted before the copy operation is performed; when the data status is soft deleted, it means that the configuration is deleted. The file with the file name #server_name# and the suffix conf in the / etc / nginx / conf.d / directory of the server where the Nginx proxy module is located is deleted; Execute the nginx-s reload hot update command to refresh the Nginx configuration and make it take effect immediately; The soft-deleted server_name information in the Nginx proxy configuration has been cleared, and the data in the WebApp table needs to be cleared synchronously; The timestamp of this scheduled task refresh is recorded in the cache for use in the next execution.

Citation Information

Patent Citations

  • Nginx dynamic configuration method and system

    CN109450708A

  • Information management system and method

    CN110784527A

  • Access processing method and device

    CN117014531A

  • Method for integrating Web system based on reverse proxy

    CN117319480A

  • Processing apparatus for monitoring and renewing digital certificates

    US20050071630A1