Configuring the HTML File
Note the precautions for configuring the HTML file for Nginx in different scenarios.
- Physical machine scenarios
HTML file policy: Each Nginx instance accesses its own HTML file.
Add an index.html file for each new Nginx instance, and distinguish the files by name.
Example: When starting the second instance in a two-CPU scenario, you need to add an index1.html file to the /usr/local/nginx/html/ directory and specify the index1.html file during the test.
1cp /usr/local/nginx/html/index.html /usr/local/nginx/html/index1.html
- Container scenarios
Add an HTML file for each new Nginx instance. After a container is set up, you need to rename the index.html file. During the client test, you need to specify the renamed index.html file. Otherwise, each container accesses the same file.
There are many containers. You can run the following script to rename index.html in the containers:
#!/bin/bash # filename: docker_cp.sh for (( i=1;i<=24;i++ )) do docker cp index.html nginx_$i:/usr/local/nginx/html/index$i.html done