Migrating a website connected to a CDN to a Windows instance
This article describes the problem description, cause, and solution to the problem that the connection is refused when a website connected to the CDN is migrated to a Windows instance.
After a website that has connected to the CDN is migrated to a Windows instance, all sites on the Windows instance cannot be accessed normally, and the connection is rejected when accessing.
After investigation, it is found that the scene has the following characteristics:
• The port 443 of the Windows instance is normally opened, and the load and bandwidth of the Windows instance do not change significantly.
• This Windows instance uses the Pagoda (BT) panel to build the website.
Note The Pagoda (BT) panel uses Apache to provide web services by default.
• The following error messages exist in Apache's error_log.
Server ran out of threads to serve requests. Consider raising the ThreadsPerChild setting
problem causes
From the error_log information of Apache, it can be judged that there is no thread on the Windows instance to process the access request, which leads to this problem.
Note The Apache program in the Windows operating system uses the mpm_winnt module, and the default number of threads for this module is 64. When the number of web requests exceeds the number of threads, Apache will not be able to provide services normally
Note The operation steps in this article are based on the 64-bit Chinese version of Windows Server 2012 R2 Data Center Edition as an example. The actual operation depends on your actual operating system.
1. Remotely connect to the Windows instance.
2. Enable the MPM module configuration file.
Important By default, the MPM module configuration file is not enabled, you need to perform the following operations to enable it.
a. Open the resource manager, find the httpd-mpm.conf configuration file and record the storage location.
b. In the httpd.conf main configuration file, perform the following operations to enable the Include conf/extra/httpd-mpm.conf configuration.
i. Find the code to be modified, the content is as follows.
# Server-pool management (MPM specific)
# Include conf/extra/httpd-mpm.conf
ii. Delete # in the # Include conf/extra/httpd-mpm.conf code to enable Include conf/extra/httpd-mpm.conf configuration, the modified code is as follows.
# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf

c. In the conf/extra/httpd-mpm.conf configuration file, check whether the value of the ThreadsPerChild parameter is 64.
NOTE The default value of the ThreadsPerChild parameter of Apache in the Windows operating system is 64.
If the value of the ThreadsPerChild parameter is 64, you need to modify the following code to change the value of the ThreadsPerChild parameter to 512, and then save the configuration.
Important 512 is an example value only, not a recommended value. You need to adjust it according to the load and access conditions of the Windows instance. For more information about this parameter, see Apache MPM Common Directives.
Threads Per Child 512
MaxRequestsPerChild0
3. Restart the Apache service.
a. In the lower left corner of the desktop, select the Start icon > Server Manager.
b. In the left navigation bar of the Server Manager page, click Local Server.
c. Locate Apache in the Services area, right-click, and click Restart Service. Apache restart service
4. Revisit the site.
If you successfully access the website, the problem is solved.
Problem Description
After a website that has connected to the CDN is migrated to a Windows instance, all sites on the Windows instance cannot be accessed normally, and the connection is rejected when accessing.
After investigation, it is found that the scene has the following characteristics:
• The port 443 of the Windows instance is normally opened, and the load and bandwidth of the Windows instance do not change significantly.
• This Windows instance uses the Pagoda (BT) panel to build the website.
Note The Pagoda (BT) panel uses Apache to provide web services by default.
• The following error messages exist in Apache's error_log.
Server ran out of threads to serve requests. Consider raising the ThreadsPerChild setting
problem causes
From the error_log information of Apache, it can be judged that there is no thread on the Windows instance to process the access request, which leads to this problem.
Note The Apache program in the Windows operating system uses the mpm_winnt module, and the default number of threads for this module is 64. When the number of web requests exceeds the number of threads, Apache will not be able to provide services normally
Solution
Note The operation steps in this article are based on the 64-bit Chinese version of Windows Server 2012 R2 Data Center Edition as an example. The actual operation depends on your actual operating system.
1. Remotely connect to the Windows instance.
2. Enable the MPM module configuration file.
Important By default, the MPM module configuration file is not enabled, you need to perform the following operations to enable it.
a. Open the resource manager, find the httpd-mpm.conf configuration file and record the storage location.
b. In the httpd.conf main configuration file, perform the following operations to enable the Include conf/extra/httpd-mpm.conf configuration.
i. Find the code to be modified, the content is as follows.
# Server-pool management (MPM specific)
# Include conf/extra/httpd-mpm.conf
ii. Delete # in the # Include conf/extra/httpd-mpm.conf code to enable Include conf/extra/httpd-mpm.conf configuration, the modified code is as follows.
# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf

c. In the conf/extra/httpd-mpm.conf configuration file, check whether the value of the ThreadsPerChild parameter is 64.
NOTE The default value of the ThreadsPerChild parameter of Apache in the Windows operating system is 64.
If the value of the ThreadsPerChild parameter is 64, you need to modify the following code to change the value of the ThreadsPerChild parameter to 512, and then save the configuration.
Important 512 is an example value only, not a recommended value. You need to adjust it according to the load and access conditions of the Windows instance. For more information about this parameter, see Apache MPM Common Directives.
Threads Per Child 512
MaxRequestsPerChild0
3. Restart the Apache service.
a. In the lower left corner of the desktop, select the Start icon > Server Manager.
b. In the left navigation bar of the Server Manager page, click Local Server.
c. Locate Apache in the Services area, right-click, and click Restart Service. Apache restart service
4. Revisit the site.
If you successfully access the website, the problem is solved.
Related Articles
-
A detailed explanation of Hadoop core architecture HDFS
Knowledge Base Team
-
What Does IOT Mean
Knowledge Base Team
-
6 Optional Technologies for Data Storage
Knowledge Base Team
-
What Is Blockchain Technology
Knowledge Base Team
Explore More Special Offers
-
Short Message Service(SMS) & Mail Service
50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00