Nginx site visualization configuration method, device and medium
Through the Nginx site visual configuration method, the entities of the Nginx configuration file are parsed and presented, allowing users to configure attributes on the visual interface, solving the problems of Nginx configuration complexity and low efficiency, and achieving efficient and secure configuration management.
Patent Information
- Application Number
- CN202310168476.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2043-02-22
AI Technical Summary
The configuration of Nginx servers is complex, the file modification is inefficient, and error-prone, and technicians who do not understand the configuration syntax are difficult to configure, which may lead to fatal impacts of the production environment.
A visual configuration method for Nginx site is proposed. By receiving user configuration requests, analyzing the configuration file to be configured as an entity, and presenting it to the user on the visual interface, enabling the user to configure the properties of the entity and finally export the target configuration file.
It realizes online visual modification of Nginx across platforms, which reduces configuration complexity, improves configuration efficiency, and reduces the possibility of configuration errors, and provides a convenient configuration editing system for non-professional operation and maintenance personnel.
Smart Images

Figure CN118535232B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of program optimization, and specifically to a method, device and medium for visually configuring an Nginx site. Background Art
[0002] Nginx is a lightweight web server / reverse proxy server and email (IMAP / POP3) proxy server, released under the BSD-like protocol. In the prior art, Nginx server configuration is complex, file modification efficiency is low, and errors are prone to occur. Some technicians who do not understand the Nginx configuration syntax have no idea where to start. If the modification is wrong, it is inconvenient to roll back and roll back, which can easily have a fatal impact on the production environment. Summary of the invention
[0003] In order to solve the above problems, the present application proposes a Nginx site visualization configuration method, device and medium, including:
[0004] A configuration request is received from a user, and based on the configuration request, a configuration file is obtained; based on the configuration request, the configuration file is parsed into entities; the entities are visualized and presented to the user so that the user can configure entity attributes of the entities; and based on the entity attribute configuration result of the user, the configuration result is exported as a target configuration file.
[0005] In one example, the entity is visualized and presented to the user, specifically including: determining each configuration contained in the entity; mapping each configuration to a unit element in the operation interface of the flet framework; and presenting the unit element to the user using a visualization page.
[0006] In one example, based on the configuration request, parsing the configuration file into entities specifically includes: determining the configuration item type contained in the configuration file according to the configuration request; classifying the configuration item type according to whether the configuration item has sub-items and whether there are judgment conditions; determining the preset type entity corresponding to the configuration file according to the configuration item type; the preset type entity includes at least a first type entity, a second type entity and a third type entity; parsing the configuration file into the preset type entity.
[0007] In one example, the attributes of the first type entity include a configuration name and storage configuration parameters; the first type entity corresponds to a configuration file without sub-items and without determination conditions.
[0008] In one example, the attributes of the second type entity include configuration name, storage determination condition, and storage tree hierarchy; the second entity type corresponds to a to-be-configured file having sub-items and determination conditions.
[0009] In one example, the attributes of the third type entity include configuration name, storage configuration parameters, and storage tree hierarchy; the third entity type corresponds to a configuration file to be configured with sub-items and no determination conditions.
[0010] In one example, the configuration file to be configured is a preset template file.
[0011] In one example, after the entity attribute configuration result of the user is exported as a target configuration file, the configuration file to be configured and the modification log are saved to a database.
[0012] The present application also provides an Nginx site visualization configuration device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute: receiving a configuration request from a user, and obtaining a configuration file to be configured based on the configuration request; parsing the configuration file to be configured into an entity based on the configuration request; visualizing the entity and presenting it to the user so that the user can configure the entity attributes of the entity; and exporting the configuration result of the user's entity attributes as a target configuration file.
[0013] The present application also provides a non-volatile computer storage medium storing computer executable instructions, characterized in that the computer executable instructions are configured to: receive a configuration request from a user, and based on the configuration request, obtain a configuration file to be configured; based on the configuration request, parse the configuration file to be configured into an entity; visualize the entity and present it to the user so that the user can configure the entity attributes of the entity; and export the result of the user's entity attribute configuration as a target configuration file.
[0014] The method proposed in this application can bring the following beneficial effects: Based on the visual interface, the present invention can realize the online modification of Nginx configuration files across platforms. Nginx visual configuration can be performed, and the configuration can be completed on the visual interface without modifying the configuration file on the command line tool. A convenient Nginx deployment configuration file visual editing system is provided for non-professional operation and maintenance delivery personnel. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0016] Figure 1A flowchart of a method for visually configuring an Nginx site in an embodiment of the present application;
[0017] Figure 2 This is a structural diagram of an Nginx site visualization configuration device in an embodiment of the present application. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0019] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0020] Figure 1 A flowchart of a method for visually configuring an Nginx site is provided for one or more embodiments of this specification. The process can be executed by a computing device in a corresponding field, and some input parameters or intermediate results in the process can be manually adjusted to help improve accuracy.
[0021] The analysis method involved in the embodiments of the present application can be implemented by a terminal device or a server, and the present application does not impose any special restrictions on this. For the convenience of understanding and description, the following embodiments are described in detail by taking a server as an example.
[0022] It should be noted that the server may be a single device or a system consisting of multiple devices, that is, a distributed server, and this application does not make any specific limitation on this.
[0023] like Figure 1 As shown, the embodiment of the present application provides a method for visually configuring an Nginx site, including:
[0024] S101: receiving a configuration request from a user, and obtaining a configuration file based on the configuration request.
[0025] If the user wants to modify the configuration file of Nginx online and visually across platforms, he should first issue a configuration request. The configuration request here should contain information such as the storage location, name, and configuration items of the configuration file to be configured. After the server receives the configuration request from the user, it will obtain the configuration file based on the content in the configuration request.
[0026] In one embodiment, the configuration file to be configured may be a template file pre-set in a database. If the configuration request does not include the storage location of the configuration file to be configured, or the user wants to modify the configuration file based on a blank configuration file, the template file may be called to modify the configuration. It should be noted that the configuration file to be configured may include different configuration items, and the configuration file to be modified may be selected according to the type of the configuration item.
[0027] The above-mentioned configuration file can be pre-stored in a storage device of the computer device. When it is necessary to obtain the configuration file, the computer device can select the configuration file from the storage device. Of course, the computer device can also obtain the configuration file from other external devices. For example, the configuration file is stored in the cloud. When it is necessary to obtain the configuration file, the computer device can obtain the configuration file from the cloud. This embodiment does not limit the method for obtaining the configuration file.
[0028] S102: Based on the configuration request, the to-be-configured file is parsed into entities.
[0029] After obtaining the configuration file to be configured, it is necessary to parse the configuration file into entities based on the configuration request. Specifically, first, according to the configuration request, the configuration item type that needs to be included in the configuration file in the configuration request must be determined. The configuration item type here is classified according to whether the configuration item has sub-items and whether there are judgment conditions. Then, according to the configuration item type included in the configuration file to be configured, the preset type entity corresponding to the configuration file to be configured is determined. Here, the first type entity, the second type entity, and the third type entity are taken as examples. Finally, the configuration file to be configured is parsed into the corresponding type of preset type entity.
[0030] The attributes of the first type of entity include configuration name and storage configuration parameters. The first type of entity corresponds to a configuration file with no sub-items and no judgment conditions, such as "listen 80;". The attributes of the second type of entity include configuration name, storage judgment conditions, and storage tree hierarchy; the second entity type corresponds to a configuration file with sub-items and judgment conditions, such as "if($request_uri~"\.{2,}"){return 402;}". The attributes of the third type of entity include configuration name, storage configuration parameters, and storage tree hierarchy; the third entity type corresponds to a configuration file with sub-items and no judgment conditions, such as "events{worker_connections1024;}. It should be noted that the storage configuration parameter attribute can store multiple configuration parameters, the storage judgment condition attribute can store multiple judgment conditions, and the storage tree hierarchy attribute can be nested with other entities.
[0031] S103: Visualize the entity and present it to the user, so that the user can configure entity attributes of the entity.
[0032] After the configuration file is parsed into entities, the entities can be visualized, thereby allowing users to configure entity properties of the entities through visualization.
[0033] Specifically, when visualizing an entity, we first need to determine the various configurations contained in the entity, then map each configuration to a unit element in the operation interface of the flet framework, and finally present the unit element to the user by using a visualization page.
[0034] S104: Exporting the entity attribute configuration result of the user into a target configuration file.
[0035] After the user completes the configuration of the entity attributes, the server can export it as a target configuration file based on the user's configuration results, thereby completing the user's cross-platform visual modification of the Nginx site configuration file.
[0036] In one embodiment, after the configuration file is modified, the configuration file to be configured and the modified configuration file may be stored in a database to prevent the need for version restoration during subsequent version upgrades.
[0037] like Figure 2 As shown, the embodiment of the present application also provides an Nginx site visualization configuration device, including: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to:
[0038] A configuration request is received from a user, and based on the configuration request, a configuration file is obtained; based on the configuration request, the configuration file is parsed into entities; the entities are visualized and presented to the user so that the user can configure entity attributes of the entities; and based on the entity attribute configuration result of the user, the configuration result is exported as a target configuration file.
[0039] The embodiment of the present application further provides a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured as follows:
[0040] A configuration request is received from a user, and based on the configuration request, a configuration file is obtained; based on the configuration request, the configuration file is parsed into entities; the entities are visualized and presented to the user so that the user can configure entity attributes of the entities; and based on the entity attribute configuration result of the user, the configuration result is exported as a target configuration file.
[0041] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0042] The devices and media provided in the embodiments of the present application correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0043] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0044] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0045] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0046] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0047] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0048] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0049] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include transitory media such as modulated data signals and carrier waves.
[0050] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0051] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A Nginx site visualization configuration method, characterized in that: include: Receiving a configuration request from a user, and obtaining a configuration file based on the configuration request; Based on the configuration request, parsing the configuration file to be configured into an entity; Visualizing the entity and presenting it to the user so that the user can configure entity attributes of the entity; Exporting the entity attribute configuration result of the user as a target configuration file; The step of parsing the configuration file to be configured into an entity based on the configuration request specifically includes: Determine, according to the configuration request, the type of configuration item included in the configuration file to be configured; the type of configuration item is classified according to whether the configuration item has sub-items and whether there are judgment conditions; According to the configuration item type, determining a preset type entity corresponding to the to-be-configured file; the preset type entity includes at least a first type entity, a second type entity and a third type entity; Parsing the configuration file to be configured into the preset type entity; The attributes of the first type of entity include configuration name and storage configuration parameters; The first type of entity corresponds to a configuration file without sub-items and judgment conditions; The attributes of the second type of entity include configuration name, storage determination condition, and storage tree level; The second type of entity corresponds to a to-be-configured file having sub-items and determination conditions; The attributes of the third type of entity include configuration name, storage configuration parameters, and storage tree level; The third type entity corresponds to a to-be-configured file having sub-items and no determination conditions.
2. The method according to claim 1, characterized in that: The visualizing the entity and presenting it to the user specifically includes: Determine each configuration included in the entity; Mapping each of the configurations to a unit element in the operation interface of the flet framework; The unit element is presented to the user using a visualization page.
3. The method according to claim 1, characterized in that The to-be-configured file is a preset template file.
4. The method according to claim 1, characterized in that After the entity attribute configuration result of the user is exported as a target configuration file, the configuration file to be configured and the modification log are saved to a database.
5. A Nginx site visual configuration device, characterized in that: include: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform: the method according to any one of claims 1 to 4.
6. A non-volatile computer storage medium storing computer executable instructions, characterized in that: The computer executable instructions are configured to execute the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Cross-platform Nginx visual configuration system and method
CN112883312A