Page switching method, device, electronic device and storage medium

By receiving task requests and calling identification file scripts and preset configuration scripts, efficient and simple page switching is achieved in traditional multi-node deployment reverse proxy servers, solving the cumbersome and time-consuming problems in traditional methods.

CN114090156BActive Publication Date: 2024-12-03CHINA CONSTRUCTION BANK
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111365219.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-17
Publication Date
2024-12-03
Estimated Expiration
2041-11-17

AI Technical Summary

Technical Problem

When switching emergency pages with traditional multi-node deployment of reverse proxy servers, the steps are cumbersome and time-consuming, and you need to log in to each network server to execute the switching configuration command.

Method used

By receiving task requests, calling the identification file script to scan the preset identification file, obtain the target user and the target network server, traverse the identification status of the reverse proxy server, identify the preset identification status and call the corresponding preset configuration script, based on the configuration script Switch page.

Benefits of technology

There is no need to log in to each network server, and the switch configuration command is executed on each network server. The steps are simple and the page switching time is short, which improves the efficiency of page switching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114090156B_ABST
    Figure CN114090156B_ABST
Patent Text Reader

Abstract

The present application discloses a page switching method, device, electronic device and storage medium. The page switching method includes: receiving a task request; based on the task request, calling an identification file script, and based on the identification file script, scanning a preset identification file to obtain a target user in the preset identification file and a target network server corresponding to the target user; traversing the identification status of each reverse proxy server corresponding to the target network server, and in the case of identifying that the identification status is a preset identification status, calling a preset configuration script of the reverse proxy server corresponding to the preset identification status; based on the preset configuration script, calling a configuration file corresponding to the preset configuration script, and switching the page to a page corresponding to the configuration file. The page switching method provided by the present application is adopted to achieve the effect of efficient, simple and convenient page switching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and in particular to a page switching method, device, electronic device and storage medium. Background Art

[0002] In projects that use multi-node mode to deploy reverse proxy servers as network servers, when the application server corresponding to the network server crashes or needs to switch to the emergency page for some reason (such as encountering a hacker attack), the traffic forwarded by the reverse proxy server will be uniformly directed to the emergency page to solve the problem of switching configuration files when the reverse proxy server is deployed as a network server in the traditional multi-node mode.

[0003] The traditional method of deploying reverse proxy servers on multiple nodes usually involves switching the reverse proxy servers one by one when switching emergency pages. This requires logging into each network server to execute the switching configuration command, which is cumbersome and time-consuming. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a page switching method, device, electronic device and storage medium to achieve the effect of efficient, simple and convenient page switching.

[0005] The technical solution of this application is as follows:

[0006] In a first aspect, a page switching method is provided, the method comprising:

[0007] Receive task requests;

[0008] Based on the task request, calling the identification file script, and based on the identification file script, scanning the preset identification file, obtaining the target user in the preset identification file, and the target network server corresponding to the target user;

[0009] Traversing the identification states of the reverse proxy servers corresponding to the target network server, and in the case of identifying that the identification state is a preset identification state, calling a preset configuration script of the reverse proxy server corresponding to the preset identification state;

[0010] Based on the preset configuration script, a configuration file corresponding to the preset configuration script is called, and a page is switched to a page corresponding to the configuration file.

[0011] In a second aspect, a page switching device is provided, the device comprising:

[0012] A task request receiving module, used for receiving a task request;

[0013] An information acquisition module, used to call an identification file script based on the task request, and scan a preset identification file based on the identification file script to obtain a target user in the preset identification file and a target network server corresponding to the target user;

[0014] A preset configuration script calling module, used for traversing the identification status of each reverse proxy server corresponding to the target network server, and in the case of identifying that the identification status is a preset identification status, calling the preset configuration script of the reverse proxy server corresponding to the preset identification status;

[0015] The page switching module is used to call the configuration file corresponding to the preset configuration script based on the preset configuration script, and switch the page to the page corresponding to the configuration file.

[0016] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the page switching method described in any one of the embodiments of the present application.

[0017] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the page switching method described in any one of the embodiments of the present application are implemented.

[0018] The technical solution provided by the embodiments of the present application brings at least the following beneficial effects:

[0019] The page switching method provided in the embodiment of the present application calls the configured identification file script based on the received task request, and scans the preset identification file based on the identification file script to obtain the target user in the preset identification file and the target network server corresponding to the target user, and traverses the identification status of each reverse proxy server corresponding to the target network server. When the identification status is identified as the preset identification status, the preset configuration script of the reverse proxy server corresponding to the preset identification status is called, and based on the preset configuration script, the configuration file corresponding to the preset configuration script is called to switch the page to the page corresponding to the configuration file. In this way, the identification status of each reverse proxy server can be preset. When the identification status is the preset identification status, the preset configuration script of the reverse proxy server corresponding to the preset identification status can be called, and based on the preset configuration script, the configuration file corresponding to the preset configuration script is called to switch the page to the page corresponding to the configuration file. In this way, there is no need to log in to each network server, and the switching configuration command is executed on the reverse proxy server configured for each network server. The steps are simple, the page switching time is short, and the efficiency of page switching is improved.

[0020] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application, and do not constitute an improper limitation on the present application.

[0022] Figure 1 This is one of the flow charts of a page switching method provided by an exemplary embodiment of the present application;

[0023] Figure 2 This is the second flow chart of a page switching method provided by an exemplary embodiment of the present application;

[0024] Figure 3 This is a third flow chart of a page switching method provided by an exemplary embodiment of the present application;

[0025] Figure 4 This is one of the load distribution diagrams involved in a page switching method provided in an exemplary embodiment of the present application;

[0026] Figure 5 This is the second load distribution diagram involved in a page switching method provided in an exemplary embodiment of the present application;

[0027] Figure 6 is a structural block diagram of a page switching device provided by an exemplary embodiment of the present application;

[0028] Figure 7 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to make those of ordinary skill in the art better understand the technical scheme of the present application, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are only examples consistent with some aspects of the present application as detailed in the attached claims.

[0031] As described in the background technology, the conventional multi-node deployment method of reverse proxy servers in the prior art has the problem of cumbersome steps and long time consumption when switching emergency pages. In order to solve the above problems, the embodiment of the present application provides a page switching method, which calls the configured identification file script based on the received task request, and scans the preset identification file based on the identification file script to obtain the target user in the preset identification file and the target network server corresponding to the target user. By traversing the identification status of each reverse proxy server corresponding to the target network server, when the identification status is identified as the preset identification status, the preset configuration script of the reverse proxy server corresponding to the preset identification status is called, and based on the preset configuration script, the configuration file corresponding to the preset configuration script is called, and the page is switched to the page corresponding to the configuration file. In this way, the identification status of each reverse proxy server can be preset. When the identification status is the preset identification status, the preset configuration script of the reverse proxy server corresponding to the preset identification status can be called, and based on the preset configuration script, the configuration file corresponding to the preset configuration script is called, and the page is switched to the page corresponding to the configuration file. In this way, there is no need to log in to each network server, and the switching configuration command is executed on the reverse proxy server configured by each network server. The steps are simple, the page switching time is short, and the efficiency of page switching is improved.

[0032] The page switching method provided in the embodiment of the present application is described in detail below through specific embodiments and application scenarios in conjunction with the accompanying drawings.

[0033] Figure 1 1 is a flow chart of a page switching method provided by an embodiment of the present application, and the execution subject of the page switching method may be a server. It should be noted that the above execution subject does not constitute a limitation on the present application.

[0034] like Figure 1 As shown, the page switching method provided in the embodiment of the present application may include steps 110 to 140.

[0035] Step 110: Receive a task request.

[0036] Step 120: Based on the task request, call the identification file script, and based on the identification file script, scan the preset identification file to obtain the target user in the preset identification file and the target network server corresponding to the target user.

[0037] Step 130: traverse the identification states of the reverse proxy servers corresponding to the target network server, and when the identification state is identified as a preset identification state, call a preset configuration script of the reverse proxy server corresponding to the preset identification state.

[0038] Step 140: Based on the preset configuration script, call the configuration file corresponding to the preset configuration script, and switch the page to the page corresponding to the configuration file.

[0039] In an embodiment of the present application, based on the received task request, a configured identification file script is called, and based on the identification file script, a preset identification file is scanned to obtain a target user in the preset identification file and a target network server corresponding to the target user. By traversing the identification status of each reverse proxy server corresponding to the target network server, when it is identified that the identification status is a preset identification status, a preset configuration script of the reverse proxy server corresponding to the preset identification status is called, and based on the preset configuration script, a configuration file corresponding to the preset configuration script is called, and the page is switched to a page corresponding to the configuration file. In this way, by pre-setting the identification status of each reverse proxy server, when the identification status is the preset identification status, the preset configuration script of the reverse proxy server corresponding to the preset identification status can be called, and based on the preset configuration script, the configuration file corresponding to the preset configuration script is called, and the page is switched to a page corresponding to the configuration file. In this way, there is no need to log in to each network server, and the switching configuration command is executed on the reverse proxy server configured for each network server. The steps are simple, the page switching time is short, and the efficiency of page switching is improved.

[0040] The page switching method provided in the embodiment of the present application is described in detail below.

[0041] First, step 110 is introduced, receiving a task request.

[0042] The task request may be a request for switching pages.

[0043] In some embodiments of the present application, before receiving a task request, the task request must first be generated. There are two ways to generate the task request, specifically, automatic and manual. The specific ways to generate the task request are as follows:

[0044] (1) Manual generation

[0045] receiving a first input from a user;

[0046] In response to the first input, a task request is generated.

[0047] Among them, the first input can be used to generate a task request, the first input can be an input to a task control, the first input can be a click input, a sliding input, a filling input, a voice input or a gesture input, and can also be a combination of at least two of the above input methods, which is not limited here.

[0048] In one example, the user may click on the task control, and the electronic device may generate a task request in response to the click input.

[0049] In an embodiment of the present application, a task request is generated manually by a user, so that a task request can be generated according to user needs, that is, a task request is generated only when the user has a request, thereby avoiding the problem that the user does not want to perform a task and causes the system to automatically execute the task.

[0050] (2) Automatic generation

[0051] Receive timing input set by the user;

[0052] generating a timing instruction in response to the timing input;

[0053] When the current time reaches the time corresponding to the timing instruction, a task request is generated.

[0054] The timing input may be a timing input performed in advance by the user.

[0055] In one example, the user may preset a time, for example, 24 hours, and the 24 hours input by the user is the timer input set by the user.

[0056] In some embodiments of the present application, the timing instruction may be an instruction generated based on the timing input of the user.

[0057] In one example, a user sets a timer time, such as 24 hours, and a timing instruction may be generated in response to the timer time set by the user.

[0058] In some embodiments of the present application, the current time may be the current time.

[0059] In one example, a user sets a timer for computer cleanup, such as 24 hours. A timer instruction may be generated in response to the timer set by the user. If 24 hours have passed since the timer set by the user, a computer cleanup task request may be automatically generated.

[0060] In an embodiment of the present application, a timing instruction is generated in response to a user's timing input, and a task request is generated when the current time reaches the time corresponding to the timing instruction. In this way, a task request can be automatically generated without the user having to manually initiate a task request each time, thereby simplifying the process of generating task requests, improving the efficiency of generating task requests, and improving the user experience.

[0061] In some embodiments of the present application, whether to generate a task request manually or automatically can be set according to user needs and is not limited here.

[0062] In some embodiments of the present application, when the user selects to automatically generate a task request, the selection of the specific timing time value can also be set according to the user's needs, which is not limited here.

[0063] Then, step 120 is introduced, in which the identification file script is called based on the task request, and based on the identification file script, the preset identification file is scanned to obtain the target user in the preset identification file and the target network server corresponding to the target user.

[0064] The identification file script may be a script for scanning a preset identification file.

[0065] In some embodiments of the present application, the preset identification file may be a file with a preset identification.

[0066] In some embodiments of the present application, the preset identification file may be a switching identification file, that is, a file with a switching identification, or may be a rollback identification file, that is, a file with a rollback identification.

[0067] In some embodiments of the present application, the target user may be any one of the users in the preset identification file.

[0068] In some embodiments of the present application, the target network server may be a network server corresponding to the target user.

[0069] In some embodiments of the present application, after obtaining a task request, an identification file script can be called based on the task request, and a preset identification file can be scanned based on the identification file script. Through the scanning, the target user in the preset identification file and the target network server corresponding to the target user can be obtained.

[0070] In one example, if Figure 2 As shown, Figure 2In the example, each network server (i.e., web1, web2, web3, ..., webn) is configured with three reverse proxy servers (i.e., ng1, ng2, and ng3). After the task request of each network server is turned on, the identification file script (start_process.sh) is called, and based on the identification file script, the preset identification file (switch identification file switch_flag.txt and rollback identification file rollback_flag.txt) is scanned. By scanning the preset identification file, the target user in the preset identification file and the target network server corresponding to the target user are obtained.

[0071] In some embodiments of the present application, the key pseudo code of the flag file script start_process.sh scanning the switch flag file switch_flag.txt is as follows:

[0072]

[0073]

[0074] sed–i “ / $h:$stype / s / 0:$u / 1:$u / g” switch_flag.txt / / Change the flag bit 0 of the current traversal line in the switch flag file switch_flag.txt back to 1, and turn off the corresponding switch configured on the corresponding server;

[0075] In some embodiments of the present application, the key pseudo code of the flag file script start_process.sh scanning the rollback flag file rollback_flag.txt is as follows:

[0076]

[0077]

[0078] sed–i “ / $h:$stype / s / 0:$u / 1:$u / g” rollback_flag.txt / / Change the flag 0 of the current traversal line in the rollback flag file rollback_flag.txt back to 1, and turn off the corresponding rollback switch configured on the corresponding server

[0079] done

[0080] In some embodiments of the present application, when the preset flag file is a switch flag file switch_flag.txt, the content of the switch flag file switch_flag.txt is as follows:

[0081] 1:username:host1:ng1

[0082] 1:username:host 2:ng1

[0083] 1:username:host3:ng1

[0084] 1:username:host1:ng2

[0085] 1:username:host 2:ng2

[0086] 1:username:host3:ng2

[0087] 1:username:host1:ng3

[0088] 1:username:host2:ng3

[0089] 1:username:host3:ng3

[0090] In the switch flag file switch_flag.txt, each line is divided into four fields by the ":" symbol. Among them, the first field indicates the switching state, 1 for no switching and 0 for switching; the second field is the current user name (i.e., the target user), which can be obtained through the whoami command in the Linux system; the third field is the host name field (i.e., the target network server), which can be obtained through the hostname command in the Linux system; the fourth field identifies the switching configuration script corresponding to the reverse proxy server (Engine x, nginx) to be switched. In the embodiment of the present application, ng1, ng2, and ng3 correspond to the configuration scripts ng1.conf, ng2.conf, and ng3.conf corresponding to the three reverse proxy servers respectively.

[0091] In some embodiments of the present application, when the preset flag file is a rollback flag file rollback_flag.txt, the content of the rollback flag file rollback_flag.txt is as follows:

[0092] 1:username:host1:ng1

[0093] 1:username:host 2:ng1

[0094] 1:username:host3:ng1

[0095] 1:username:host1:ng2

[0096] 1:username:host 2:ng2

[0097] 1:username:host3:ng2

[0098] 1:username:host1:ng3

[0099] 1:username:host2:ng3

[0100] 1:username:host3:ng3

[0101] In the rollback flag file rollback_flag.txt, each line is divided into four fields by the ":" symbol. Among them, the first field is the rollback status, 1 for no rollback, and 0 for rollback; the second field is the current user name (i.e., the target user), which can be obtained through the whoami command in the Linux system; the third field is the host name field (i.e., the target network server), which can be obtained through the hostname command in the Linux system; the fourth field identifies the switching configuration script corresponding to the reverse proxy server (Engine x, nginx) to be rolled back. In the embodiment of the present application, ng1, ng2, and ng3 correspond to the configuration scripts ng1.conf, ng2.conf, and ng3.conf corresponding to the three reverse proxy servers respectively.

[0102] It should be noted that the contents of the above-mentioned rollback identification file rollback_flag.txt and the switch identification file switch_flag.txt only show three reverse proxy servers, but it does not mean that in the embodiment of the present application, each network server can only be configured with three reverse proxy servers. The specific number of reverse proxy servers configured for each network server can be set according to user needs and is not limited here.

[0103] Next, step 130 is introduced, traversing the identification states of the reverse proxy servers corresponding to the target network server, and when the identification state is identified as a preset identification state, calling the preset configuration script of the reverse proxy server corresponding to the preset identification state.

[0104] The identification status of each reverse proxy server may be the status of an identification in each reverse proxy server.

[0105] In an example, taking the switch flag file switch_flag.txt described above as being scanned, the flag status may be a flag indicating whether to switch in the switch flag file switch_flag.txt, that is, the first field in each line of the switch flag file switch_flag.txt (if the rollback flag file rollback_flag.txt is scanned, the flag status may be a flag indicating whether to roll back in the rollback flag file rollback_flag.txt, that is, the first field in each line of the rollback flag file rollback_flag.txt).

[0106] In some embodiments of the present application, the preset identification state may be a pre-set identification state, that is, it may be a pre-set state for the state of the identification in each reverse proxy server.

[0107] In some embodiments of the present application, the preset identification file may be a switching identification file. In this case, when the preset identification file is a switching identification file, the preset identification state may be a switching identification state.

[0108] The switching identification state may be an identification state in the reverse proxy server, which represents an identification state to be switched by the reverse proxy server.

[0109] In an example, for the switch flag file switch_flag.txt described above, the preset flag state may be that the switch flag in the switch flag file switch_flag.txt is 0, which indicates a state of switching.

[0110] In some embodiments of the present application, the preset identification file may also be a rollback identification file. In this case, when the preset identification file is a rollback identification file, the preset identification state may be a rollback identification state.

[0111] The rollback identification state may be an identification state in the reverse proxy server, which represents an identification state that the reverse proxy server is to be rolled back.

[0112] In an example, for the rollback flag file rollback_flag.txt, the preset flag state may be that the rollback flag in the rollback flag file rollback_flag.txt is 0, which indicates a rollback state.

[0113] In some embodiments of the present application, the preset configuration script of the reverse proxy server corresponding to the preset identification state may be a configuration script corresponding to the reverse proxy server corresponding to the preset identification state.

[0114] In some embodiments of the present application, the preset identification file may be a switching identification file. In this case, when the preset identification file is a switching identification file, when the identification state is identified as a switching identification state, the switching configuration script of the reverse proxy server corresponding to the switching identification state is called.

[0115] In one example, if Figure 2As shown, the switch identification file switch_flag.txt described above is scanned to obtain the target user in the switch identification file switch_flag.txt and the target network server corresponding to the target user, for example, it may be the host 1 in the switch identification file switch_flag.txt. When the target network server is the host 1, the host 1 has three reverse proxy servers (i.e., ng1, ng2, and ng3), the identification states corresponding to the three reverse proxies are identified (i.e., the first fields in 1:username:host1:ng1; 1:username:host1:ng2 and 1:username:host1:ng3 are identified). When it is identified that the first field is the identification state for switching (for example, it is identified that the first field in 1:username:host1:ng1 is 0, and the first fields in 1:username:host1:ng2 and 1:username:host1:ng3 are both 1), the switching configuration script corresponding to the reverse proxy server ng1 is called, that is, the switching configuration script switch_ng1.sh corresponding to the reverse proxy server ng1 is called.

[0116] In some embodiments of the present application, the preset identification file may also be a rollback identification file. In the case where the preset identification file is a rollback identification file, when the identification state is identified as a rollback identification state, the rollback configuration script of the reverse proxy server corresponding to the rollback identification state is called.

[0117] In one example, if Figure 2 As shown, the rollback identification file rollback_flag.txt described above is scanned, and the target user in the rollback identification file rollback_flag.txt and the target network server corresponding to the target user are obtained, for example, it can be the host 1 in the rollback identification file rollback_flag.txt. Then, when the target network server is host 1, there are three reverse proxy servers (namely ng1, ng2, and ng3) under the host 1, and the identification states corresponding to the three reverse proxies are identified (namely, the first fields in 1:username:host1:ng1; 1:username:host1:ng2 and 1:username:host1:ng3 are identified). When it is identified that the first field is the identification state for rollback (for example, it is identified that the first field in 1:username:host1:ng1 is 0, and the first fields in 1:username:host1:ng2 and 1:username:host1:ng3 are both 1), the rollback configuration script corresponding to the reverse proxy server ng1 is called, that is, the switching configuration script rollback_ng1.sh corresponding to the reverse proxy server ng1 is called.

[0118] It should be noted that Figure 2 The switch_ng1.sh in the script is the switch configuration script corresponding to the reverse proxy ng1, the switch_ng2.sh is the switch configuration script corresponding to the reverse proxy ng2, and the switch_ng3.sh is the switch configuration script corresponding to the reverse proxy ng3. Figure 2 The rollback_ng1.sh in the figure is the rollback configuration script corresponding to the reverse proxy ng1, the rollback_ng2.sh is the rollback configuration script corresponding to the reverse proxy ng2, and the rollback_ng3.sh is the rollback configuration script corresponding to the reverse proxy ng3.

[0119] In some embodiments of the present application, the key pseudo code of the switch identification script switch_ng_flag.sh is as follows, taking switch_ng1_flag.sh as an example:

[0120] homedir="working directory"

[0121] cd$homedir / / Switch to the script working directory

[0122] u = `whoami` / / Get username

[0123] h=`hostname` / / Get the host name

[0124] sed –i “ / ng1 / s / 1:$u / 0:$u / g” switch_flag.txt / / Change the switch flag 1 in the switch flag file switch_flag.txt that contains the ng1 configuration line to 0 in batches.

[0125] It should be noted that switch_ng2_flag.sh and switch_ng2_flag.sh are similar to switch_ng1_flag.sh, except that ng1 is changed to the corresponding ng configuration. The other scripts and configuration instructions are also the same and will not be repeated here.

[0126] In some embodiments of the present application, the key pseudo code of the rollback flag script rollback_ng_flag.sh is as follows, taking rollback_ng1_flag.sh as an example:

[0127] homedir="working directory"

[0128] cd$homedir / / Switch to the script working directory

[0129] u = `whoami` / / Get username

[0130] h=`hostname` / / Get the host name

[0131] sed –i “ / ng1 / s / 1:$u / 0:$u / g” rollback_flag.txt / / Change the rollback flag 1 in the rollback flag file rollback_flag.txt that contains the ng1 configuration line to 0 in batches

[0132] It should be noted that rollback_ng2_flag.sh and rollback_ng2_flag.sh are similar to rollback_ng1_flag.sh, except that ng1 is changed to the corresponding ng configuration.

[0133] In some embodiments of the present application, the key pseudo code of the switch configuration script switch_ng.sh is as follows, taking switch_ng1.sh as an example:

[0134] nginxdir="nginx working directory"

[0135] cd$nginxdir / / Switch to the nginx working directory

[0136] ng1Dir="Directory of ng1.conf configuration file"

[0137] ng1Emg="Directory of the ng1_emergency.conf configuration file"

[0138] nginx –c$ng1Dir / ng1.conf –s stop / / Stop the process started by the original nginx configuration ng1.conf

[0139] nginx –c$ng1Emg / ng1_emergency.conf / / Use the emergency configuration ng1_emergency.conf to start the nginx process.

[0140] In some embodiments of the present application, the key pseudo code of the rollback configuration script rollback_ng.sh is as follows, taking rollback_ng1.sh as an example:

[0141] nginxdir="nginx working directory"

[0142] cd$nginxdir / / Switch to the nginx working directory

[0143] ng1Dir="Directory of ng1.conf configuration file"

[0144] ng1Emg="Directory of the ng1_emergency.conf configuration file"

[0145] nginx –c$ng1Emg / ng1_emergency.conf –s stop / / Stop the process started by the emergency configuration ng1_emergency.conf

[0146] nginx –c$ng1Dir / ng1.conf / / Use the original nginx configuration ng1.conf to start the nginx process

[0147] Finally, step 140 is introduced: based on the preset configuration script, the configuration file corresponding to the preset configuration script is called, and the page is switched to the page corresponding to the configuration file.

[0148] The configuration file may be a configuration file corresponding to a preset configuration script.

[0149] In some embodiments of the present application, the preset identification file may be a switching identification file. In the case where the preset identification file is a switching identification file, the preset identification state may be a switching identification state, the preset configuration script is a switching configuration script, and calling the configuration file corresponding to the switching configuration script may be calling the switching configuration file corresponding to the switching configuration script.

[0150] In one example, if Figure 2As shown, continuing to refer to the above example, the switch identification file switch_flag.txt mentioned above is scanned, then the target user in the switch identification file switch_flag.txt and the target network server corresponding to the target user are obtained, for example, it can be the host 1 in the above switch identification file switch_flag.txt. Then, when the target network server is host 1, when it is identified that the first field in 1:username:host1:ng1 is 0, and the first fields in 1:username:host1:ng2 and 1:username:host1:ng3 are both 1, the switch configuration script switch_ng1.sh corresponding to the reverse proxy server ng1 is called, and based on the switch configuration script switch_ng1.sh, the switch configuration file ng1_emergency.conf corresponding to the switch configuration script switch_ng1.sh can be called. Based on the switching configuration file ng1_emergency.conf, the current page of the ng1 reverse proxy server configured on host 1 can be switched to the corresponding page in the configuration file ng1_emergency.conf. For example, the page described in the configuration file ng1_emergency.conf is an emergency page such as "Page lost, 404". Based on the configuration file ng1_emergency.conf, the current page of the ng1 reverse proxy server configured on host 1 can be switched to an emergency page such as "Page lost, 404".

[0151] In some embodiments of the present application, the preset identification file may be a rollback identification file. In this case, when the preset identification file is a rollback identification file, the preset identification state may be a rollback identification state, the preset configuration script may be a rollback configuration script, and calling the configuration file corresponding to the rollback configuration script may be calling the rollback configuration file corresponding to the rollback configuration script.

[0152] In one example, if Figure 2As shown, continuing to refer to the above example, the scanned file is the rollback identification file rollback_flag.txt mentioned above, then the target user in the rollback identification file rollback_flag.txt and the target network server corresponding to the target user are obtained, for example, it can be the host 1 in the above rollback identification file rollback_flag.txt. Then, when the target network server is host 1, when it is identified that the first field in 1:username:host1:ng1 is 0, and the first fields in 1:username:host1:ng2 and 1:username:host1:ng3 are both 1, then the rollback configuration script rollback_ng1.sh corresponding to the reverse proxy server ng1 is called, and based on the rollback configuration script rollback_ng1.sh, the rollback configuration file ng1_.conf corresponding to the rollback configuration script rollback_ng1.sh can be called. Based on the rollback configuration file ng1_.conf, the current page of the ng1 reverse proxy server configured on host 1 can be rolled back to the corresponding page in the rollback configuration file ng1_.conf. For example, the page described in the rollback configuration file ng1_.conf is the previous page of the current page. Based on the rollback configuration file ng1_.conf, the current page of the ng1 reverse proxy server configured on host 1 can be rolled back to the previous page of the current page.

[0153] It should be noted that Figure 2 In the switch_ng1.sh is the switch configuration script corresponding to the reverse proxy ng1, ng1_emergency.conf is the configuration file corresponding to switch_ng1.sh; switch_ng2.sh is the switch configuration script corresponding to the reverse proxy ng2, ng2_emergency.conf is the configuration file corresponding to switch_ng2.sh; switch_ng3.sh is the switch configuration script corresponding to the reverse proxy ng3, ng3_emergency.conf is the configuration file corresponding to switch_ng3.sh. Correspondingly, Figure 2 rollback_ng1.sh is the rollback configuration script corresponding to the reverse proxy ng1, ng1_.conf is the configuration file corresponding to rollback_ng1.sh; rollback_ng2.sh is the rollback configuration script corresponding to the reverse proxy ng2, ng2_.conf is the configuration file corresponding to rollback_ng2.sh; rollback_ng3.sh is the rollback configuration script corresponding to the reverse proxy ng3, ng3_.conf is the configuration file corresponding to rollback_ng3.sh.

[0154] In some embodiments of the present application, the key configuration of the switching configuration file ng_emergency.conf is as follows, taking ng1_emergency.conf as an example:

[0155] Location / {

[0156] The path of the root emergency page in the nas;

[0157] try_files / emergency page homepage=404;

[0158] }

[0159] It should be noted that the switching page in the specific switching configuration file can be customized according to the actual situation of the project. The above is only an example and is not limited here.

[0160] In some embodiments of the present application, the rollback configuration file ng.conf is similar to the switching configuration file and will not be described in detail here.

[0161] It should be noted that the rollback page in the specific rollback configuration file can be customized according to the actual situation of the project. The above is only an example and is not limited here.

[0162] In an embodiment of the present application, based on the received task request, a configured identification file script is called, and based on the identification file script, a preset identification file is scanned to obtain a target user in the preset identification file and a target network server corresponding to the target user. By traversing the identification status of each reverse proxy server corresponding to the target network server, when it is identified that the identification status is a preset identification status, a preset configuration script of the reverse proxy server corresponding to the preset identification status is called, and based on the preset configuration script, a configuration file corresponding to the preset configuration script is called, and the page is switched to a page corresponding to the configuration file. In this way, by pre-setting the identification status of each reverse proxy server, when the identification status is the preset identification status, the preset configuration script of the reverse proxy server corresponding to the preset identification status can be called, and based on the preset configuration script, the configuration file corresponding to the preset configuration script is called, and the page is switched to a page corresponding to the configuration file. In this way, there is no need to log in to each network server, and the switching configuration command is executed on the reverse proxy server configured for each network server. The steps are simple, the page switching time is short, and the efficiency of page switching is improved.

[0163] In some embodiments of the present application, during the page switching process, it may be necessary to modify the identification status of each reverse proxy server, for example, to modify Figure 2The switch flag of the first reverse proxy server ng1 among the three reverse proxy servers of web1, for example, the switch flag of the reverse proxy server ng1 was originally 0, and now it needs to be changed to 1. In the prior art, it is necessary to open the switch flag file, and then modify the switch flags of ng1 in the switch flag file switch_flag.txt, that is, the first fields of 1:username:host1:ng1; 1:username:host1:ng2 and 1:username:host1:ng3 are modified respectively, and the modification steps are cumbersome.

[0164] In some embodiments of the present application, in order to solve the problem of cumbersome modification steps, the present application provides another method for implementing the page switching method. Figure 3 .

[0165] like Figure 3 As shown, the page switching method provided in the embodiment of the present application may specifically include the following steps 310 to 340:

[0166] Step 310: Receive a request to change the identification status corresponding to the target reverse proxy server.

[0167] The target reverse proxy server may be any one or more of the multiple reverse proxy servers.

[0168] In one example, if Figure 2 As shown, Figure 2 In the example, each network server (ie, web1, web2, web3, ..., webn) is configured with three reverse proxy servers (ie, ng1, ng2, and ng3). The target direction proxy server can be any one or more of ng1, ng2, and ng3.

[0169] In some embodiments of the present application, the change request may be a request to change the identification state corresponding to the target reverse proxy server. Figure 2 A request to switch the identity of the reverse proxy server ng1 among the three reverse proxy servers of web1.

[0170] In some embodiments of the present application, the change request may be generated manually or automatically. The specific method of generating the change request is as follows:

[0171] (1) Manual generation

[0172] receiving a second input from the user;

[0173] In response to the second input, a change request is generated.

[0174] Among them, the second input can be used to generate a change request, the second input can be an input to the change control, the second input can be a click input, a sliding input, a filling input, a voice input or a gesture input, and can also be a combination of at least two of the above input methods, which is not limited here.

[0175] In one example, the user may modify the control by clicking on it, and the electronic device may generate a modification request in response to the click input.

[0176] In an embodiment of the present application, a change request is generated manually by the user, so that the change request can be generated according to the user's needs, that is, a change request is generated only when the user has a request, thereby avoiding the problem that the user does not want to perform a task and causes the system to automatically execute the task.

[0177] (2) Automatic generation

[0178] Receive input of a change timing set by a user;

[0179] In response to the change timing input, generating a change timing instruction;

[0180] When the current time reaches the time corresponding to the timing change instruction, a change request is generated.

[0181] The timing change input may be a timing change input made in advance by the user.

[0182] In one example, the user may preset a time, for example, 24 hours, and the 24 hours input by the user is the change timing input set by the user.

[0183] In some embodiments of the present application, the timing change instruction may be an instruction generated based on a user's input of changing the timing.

[0184] In one example, a user sets a timing time, such as 24 hours, and a timing change instruction may be generated in response to the timing change time set by the user.

[0185] In some embodiments of the present application, the current time may be the current time.

[0186] In one example, a user sets a change timing time for changing the identification status of a certain reverse proxy server, for example, it may be 24 hours. A change timing instruction may be generated in response to the change timing time set by the user. If 24 hours have passed since the change timing time set by the user, a change request for changing the identification status of a certain reverse proxy server may be automatically generated.

[0187] In an embodiment of the present application, a change timing instruction is generated in response to the user's change timing input, and a change request is generated when the current time reaches the time corresponding to the change timing instruction. In this way, the change request can be automatically generated without the user having to manually initiate the change request each time, thereby simplifying the process of generating change requests, improving the efficiency of generating change requests, and improving the user experience.

[0188] In some embodiments of the present application, whether to generate the change request manually or automatically can be set according to user needs and is not limited here.

[0189] In some embodiments of the present application, when the user selects to automatically generate a change request, the selection of a specific value for changing the timing time can also be set according to user needs, which is not limited here.

[0190] Step 320: Based on the change request, call a preset identification script corresponding to the target reverse proxy server.

[0191] The preset identification script may include a switching identification script or a rollback identification script.

[0192] In some embodiments of the present application, the change request may be a request to change the switch identification state of a certain (or several) reverse proxy servers, and based on the change request, the switch identification script corresponding to the target reverse proxy server is called.

[0193] In one example, if Figure 2 As shown, in the case where the change request may be a request to change the switch flag state of a certain (or several) reverse proxy servers, the switch flag script switch_ng_flag.sh corresponding to the target reverse proxy server can be called based on the change request. The switch flag script corresponding to the reverse proxy server whose switch flag state needs to be changed should be called accordingly. For example, if the switch flag state of the reverse proxy server ng1 needs to be changed, the switch flag script switch_ng1_flag.sh corresponding to the reverse proxy server ng1 should be called accordingly.

[0194] In some embodiments of the present application, the change request may also be a request to change the rollback identification state of a certain (or several) reverse proxy servers, and based on the change request, the rollback identification script corresponding to the target reverse proxy server is called.

[0195] In one example, if Figure 2As shown, in the case where the change request may be a request to change the rollback flag state of a certain (or several) reverse proxy servers, the rollback flag script rollback_ng_flag.sh corresponding to the target reverse proxy server can be called based on the change request. The rollback flag script corresponding to the reverse proxy server whose rollback flag state needs to be changed is called accordingly. For example, if the rollback flag state of the reverse proxy server ng1 needs to be changed, the rollback flag script rollback_ng1_flag.sh corresponding to the reverse proxy server ng1 is called accordingly.

[0196] Step 330: Receive input for changing the identification status in the preset identification script.

[0197] Among them, the input for changing the identification state in the preset identification script can be an input for changing the identification state in the preset identification script.

[0198] In some embodiments of the present application, when the change is a request to change the switch identification state of a certain (or several) reverse proxy servers, the switch identification script corresponding to the target reverse proxy server is called, and then the identification state in the switch identification script is changed.

[0199] In one example, if Figure 2 As shown, in the case where the change request may be a request to change the switch flag state of the reverse proxy server ng1, such as changing the switch flag state from 0 to 1, based on the change request, the switch flag script switch_ng1_flag.sh corresponding to the reverse proxy server ng1 may be called, and then the switch flag state in the switch flag script switch_ng1_flag.sh may be changed from 0 to 1.

[0200] In some embodiments of the present application, when the change is a request to change the rollback identification state of a certain (or several) reverse proxy servers, the rollback identification script corresponding to the target reverse proxy server is called, and then the identification state in the rollback identification script is changed.

[0201] In one example, if Figure 2 As shown, in the case where the change request may be a request to change the rollback flag state of the reverse proxy server ng1, such as changing the rollback flag state from 0 to 1, based on the change request, the rollback flag script rollback_ng1_flag.sh corresponding to the reverse proxy server ng1 may be called, and then the rollback flag state in the rollback flag script rollback_ng1_flag.sh may be changed from 0 to 1.

[0202] Step 340: In response to the change input, the identification state corresponding to the target reverse proxy server in the preset identification file script is changed.

[0203] In some embodiments of the present application, after receiving the change input of the identification state in the preset identification script, the identification state corresponding to the target reverse proxy server in the preset identification file script can be changed in response to the change input. In this way, the identification state of the target reverse proxy server can be changed in batches, without the user opening the preset identification file and then changing the identification state of the target reverse proxy server one by one. The operation is simple and convenient, and the efficiency of changing the identification state of the target reverse proxy server is improved.

[0204] In an embodiment of the present application, a request for changing the identification status corresponding to the target reverse proxy server is received, and based on the change request, a preset identification script corresponding to the target reverse proxy server is called, and an input for changing the identification status in the preset identification script is received. In response to the change input, the identification status corresponding to the target reverse proxy server in the preset identification file script is changed. In this way, the identification status of the target reverse proxy servers can be changed in batches without the user having to open the preset identification file and then change the identification status of the target reverse proxy servers therein one by one. The operation is simple and convenient, and the efficiency of changing the identification status of the target reverse proxy servers is improved.

[0205] In some embodiments of the present application, in the prior art, such as Figure 4 The configuration topology diagram of the network server in the prior art is shown. Figure 4 As can be seen in the figure, since each network server (i.e., web1, web2, web3, ... webn) is equipped with three reverse proxy servers, namely AP1, AP2 and AP3, the Internet traffic is loaded to each web server through hardware load balancing, and then reversely proxied to each network server by the reverse proxy server on the web server. Since each configuration file is set in the reverse proxy server, the traditional multi-node deployment of reverse proxy will switch pages by modifying the upstream front-end project content when switching pages. However, this method will forward traffic to the network server corresponding to the reverse proxy server, which is not safe enough when encountering hacker attacks.

[0206] In some embodiments of the present application, in order to solve the problem that the page switching is performed by modifying the upstream front-end engineering content, which results in the forwarding of traffic to the network server corresponding to the reverse proxy server, and is not safe enough when encountering hacker attacks, in the embodiments of the present application, the identification file script, the preset identification file, the preset configuration script, the configuration file corresponding to the preset configuration script, and the preset identification script are all set in the network attached storage, and the network attached storage is mounted in each network server. In this way, when the configuration is switched, the traffic is directed to the network attached storage, and the application server is not invaded, thereby ensuring security when encountering hacker attacks. Figure 5 As shown, Internet traffic is loaded to each web server through hardware load balancing, and is reverse-proxied by the reverse proxy server on the web server to the emergency page resources in the network attached storage nas (directing all traffic to the emergency page).

[0207] In some embodiments of the present application, since the single-line preset identification status in the preset identification file can be modified, and the preset identification file is placed in the network-attached storage, it is only necessary to log in to a network server and modify the preset identification file to control the specified reverse proxy server process of the specified network server to switch (or roll back) the configuration.

[0208] It should be noted that the data access method provided in the embodiment of the present application can be executed by a data access device or a control module in the data access device for executing the data access method. In the embodiment of the present application, the data access device provided in the embodiment of the present application is illustrated by taking the data access method executed by the data access device as an example.

[0209] Based on the same inventive concept as the above-mentioned page switching method, the present application also provides a page switching device, which is applied to a server. Figure 6 The page switching device provided in the embodiment of the present application is described in detail.

[0210] Figure 6 The figure is a structural block diagram of a page switching device according to an exemplary embodiment.

[0211] like Figure 6 As shown, the data access device 600 may include:

[0212] The task request receiving module 610 is used to receive a task request;

[0213] The information acquisition module 620 is used to call the identification file script based on the task request, and scan the preset identification file based on the identification file script to obtain the target user in the preset identification file and the target network server corresponding to the target user;

[0214] A preset configuration script calling module 630 is used to traverse the identification status of each reverse proxy server corresponding to the target network server, and when the identification status is identified as a preset identification status, call the preset configuration script of the reverse proxy server corresponding to the preset identification status;

[0215] The page switching module 640 is used to call the configuration file corresponding to the preset configuration script based on the preset configuration script, and switch the page to the page corresponding to the configuration file.

[0216] In an embodiment of the present application, a task request is obtained through a task request receiving module, and a configured identification file script is called based on the information acquisition module based on the received task request, and a preset identification file is scanned based on the identification file script to obtain a target user in the preset identification file and a target network server corresponding to the target user. A module based on a preset configuration script is called to traverse the identification status of each reverse proxy server corresponding to the target network server, and when the identification status is identified as a preset identification status, a preset configuration script of the reverse proxy server corresponding to the preset identification status is called, and a page switching module based on the preset configuration script calls a configuration file corresponding to the preset configuration script based on the preset configuration script, and switches the page to a page corresponding to the configuration file. In this way, the identification status of each reverse proxy server can be preset. When the identification status is the preset identification status, the preset configuration script of the reverse proxy server corresponding to the preset identification status can be called, and based on the preset configuration script, the configuration file corresponding to the preset configuration script is called, and the page is switched to a page corresponding to the configuration file. In this way, there is no need to log in to each network server, and the switching configuration command is executed on the reverse proxy server configured for each network server. The steps are simple, the page switching time is short, and the efficiency of page switching is improved.

[0217] In some embodiments of the present application, the preset identification file includes: a switching identification file, a preset configuration script calling module 630, specifically used for:

[0218] Traversing the identification states of the reverse proxy servers corresponding to the target network server, and in the case of identifying that the identification state is a switching identification state, calling a switching configuration script of the reverse proxy server corresponding to the switching identification state;

[0219] Correspondingly, the page switching module 640 is specifically used for:

[0220] Based on the switching configuration script, a switching configuration file corresponding to the switching configuration script is called, and a page is switched to a page corresponding to the switching configuration file.

[0221] In some embodiments of the present application, the preset identification file includes: a rollback identification file; a preset configuration script calling module 630, which is specifically used to:

[0222] Traversing the identification states of the reverse proxy servers corresponding to the target network server, and in the case of identifying that the identification state is a rollback identification state, calling a rollback configuration script of the reverse proxy server corresponding to the rollback identification state;

[0223] Correspondingly, the page switching module 640 is specifically used for:

[0224] Based on the rollback configuration script, a rollback configuration file corresponding to the rollback configuration script is called to roll back the page to the page corresponding to the rollback configuration file.

[0225] In some embodiments of the present application, the page switching device may further include:

[0226] A change request receiving module, used for receiving a change request for the identification status corresponding to the target reverse proxy server;

[0227] A preset identification script calling module, used to call a preset identification script corresponding to the target reverse proxy server based on the change request; wherein the preset identification script includes a switch identification script or a rollback identification script;

[0228] A change input receiving module, used for receiving a change input of the identification state in the preset identification script;

[0229] The identification state changing module is used to change the identification state corresponding to the target reverse proxy server in the preset identification file script in response to the change input.

[0230] In some embodiments of the present application, the page switching device may further include:

[0231] A first input receiving module, used to receive a first input from a user;

[0232] The first task request generating module is used to generate a task request in response to the first input.

[0233] In some embodiments of the present application, the page switching device may further include:

[0234] A timing input receiving module, used to receive the timing input set by the user;

[0235] A timing instruction generating module, used for generating a timing instruction in response to the timing input;

[0236] The second task request generating module is used to generate a task request when the current time reaches the time corresponding to the timing instruction.

[0237] The page switching device provided in the embodiment of the present application can be used to execute the page switching method provided in the above-mentioned method embodiments. Its implementation principle and technical effect are similar, and for the sake of brief introduction, they will not be repeated here.

[0238] Based on the same inventive concept, an embodiment of the present application also provides an electronic device.

[0239] Figure 7 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device may include a processor 701 and a memory 702 storing computer programs or instructions.

[0240] Specifically, the processor 701 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present invention.

[0241] The memory 702 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 702 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 702 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 702 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 702 is a non-volatile solid-state memory. In a specific embodiment, the memory 702 includes a read-only memory (ROM). In appropriate cases, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.

[0242] The processor 701 implements any one of the page switching methods in the above embodiments by reading and executing computer program instructions stored in the memory 702 .

[0243] In one example, the electronic device may further include a communication interface 703 and a bus 710. Figure 7As shown, the processor 701, the memory 702, and the communication interface 703 are connected via a bus 710 and communicate with each other.

[0244] The communication interface 703 is mainly used to implement the communication between the modules, devices, units and / or devices in the embodiment of the present invention.

[0245] Bus 710 includes hardware, software or both, and the parts of electronic equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 710 may include one or more buses. Although the embodiment of the present invention describes and shows a specific bus, the present invention considers any suitable bus or interconnection.

[0246] The electronic device can execute the page switching method in the embodiment of the present invention, thereby realizing Figure 1-Figure 5 Any of the page switching methods described.

[0247] In addition, in combination with the page switching method in the above embodiment, the embodiment of the present invention can provide a readable storage medium to implement. The readable storage medium stores program instructions; when the program instructions are executed by a processor, any one of the page switching methods in the above embodiment is implemented.

[0248] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.

[0249] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0250] It should also be noted that the exemplary embodiments mentioned in the present invention describe some methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiments, or in a different order from the embodiments, or several steps can be performed simultaneously.

[0251] The above is only a specific implementation of the present invention. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the system, module and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be covered within the protection scope of the present invention.

Claims

1. A page switching method, characterized in that: The method comprises: Receive task requests; Based on the task request, calling the identification file script, and based on the identification file script, scanning the preset identification file, obtaining the target user in the preset identification file, and the target network server corresponding to the target user, wherein the preset identification file includes: identification status, user name, network server and reverse proxy server corresponding to the network server, and the identification status includes switching status or rollback status; Traversing the identification states of the reverse proxy servers corresponding to the target network server, and in the case of identifying that the identification state is a preset identification state, calling a preset configuration script of the reverse proxy server corresponding to the preset identification state; Based on the preset configuration script, calling the configuration file corresponding to the preset configuration script, and switching the page to the page corresponding to the configuration file; The method further comprises: Receiving a request to change the identification state corresponding to the target reverse proxy server; Based on the change request, calling a preset identification script corresponding to the target reverse proxy server; wherein the preset identification script includes a switch identification script or a rollback identification script; Receiving input for changing the identification state in the preset identification script; In response to the change input, changing the identification state corresponding to the target reverse proxy server in the preset identification file script; The identification file script, the preset identification file, the preset configuration script, the configuration file corresponding to the preset configuration script and the preset identification script are all set in a network attached storage, and the network attached storage is mounted in each network server.

2. The method according to claim 1, characterized in that The preset identification file includes: a switching identification file; In the case where the identification state is identified as a preset identification state, calling a preset configuration script of the reverse proxy server corresponding to the preset identification state includes: In the case where it is identified that the identification state is a switching identification state, calling a switching configuration script of the reverse proxy server corresponding to the switching identification state; The calling of a configuration file corresponding to the preset configuration script based on the preset configuration script, and switching a page to a page corresponding to the configuration file, includes: Based on the switching configuration script, a switching configuration file corresponding to the switching configuration script is called, and a page is switched to a page corresponding to the switching configuration file.

3. The method according to claim 1, characterized in that The preset identification file includes: a rollback identification file; In the case where the identification state is identified as a preset identification state, calling a preset configuration script of the reverse proxy server corresponding to the preset identification state includes: In the case of identifying that the identification state is a rollback identification state, calling a rollback configuration script of the reverse proxy server corresponding to the rollback identification state; The calling of a configuration file corresponding to the preset configuration script based on the preset configuration script, and switching a page to a page corresponding to the configuration file, includes: Based on the rollback configuration script, a rollback configuration file corresponding to the rollback configuration script is called to roll back the page to the page corresponding to the rollback configuration file.

4. The method according to claim 1, characterized in that: Before receiving the task request, the method further includes: receiving a first input from a user; In response to the first input, a task request is generated.

5. The method according to claim 1, characterized in that Before receiving the task request, the method further includes: Receive timing input set by the user; generating a timing instruction in response to the timing input; When the current time reaches the time corresponding to the timing instruction, a task request is generated.

6. A page switching device, characterized in that: The device comprises: A task request receiving module, used for receiving a task request; An information acquisition module is used to call an identification file script based on the task request, and scan a preset identification file based on the identification file script to obtain a target user in the preset identification file and a target network server corresponding to the target user, wherein the preset identification file includes: an identification state, a user name, a network server and a reverse proxy server corresponding to the network server, and the identification state includes a switching state or a rollback state; A preset configuration script calling module, used for traversing the identification status of each reverse proxy server corresponding to the target network server, and in the case of identifying that the identification status is a preset identification status, calling the preset configuration script of the reverse proxy server corresponding to the preset identification status; A page switching module, used to call a configuration file corresponding to the preset configuration script based on the preset configuration script, and switch the page to a page corresponding to the configuration file; The device also includes: A change request receiving module, used for receiving a change request for the identification status corresponding to the target reverse proxy server; A preset identification script calling module, used to call a preset identification script corresponding to the target reverse proxy server based on the change request; wherein the preset identification script includes a switch identification script or a rollback identification script; A change input receiving module, used for receiving a change input of the identification state in the preset identification script; An identification state changing module is used to change the identification state corresponding to the target reverse proxy server in the preset identification file script in response to the change input, wherein the identification file script, the preset identification file, the preset configuration script, the configuration file corresponding to the preset configuration script and the preset identification script are all set in a network attached storage, and the network attached storage is mounted in each network server.

7. An electronic device, characterized in that: It comprises a processor, a memory and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the page switching method as described in any one of claims 1 to 5.

8. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the page switching method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Nginx configuration method and device

    CN104468226A

  • Method and system for switching nginx configuration files through scripts

    CN112069435A