In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article "how to configure Nginx server display random home page and blank picture" article knowledge point most people do not understand, so Xiaobian to everyone summarized the following content, detailed content, clear steps, has a certain reference value, I hope you can read this article to gain, let's take a look at this article "how to configure Nginx server display random home page and blank picture" article bar.
Display random index
In general, a site default home page is defined good index.html, index.shtml, index.php, etc., if you want to have a lot of pages under the site want to randomly show to users browsing, that has to be implemented on the program, it is particularly troublesome, if you install nginx, then use nginx random index to achieve this function, all requests ending with/, will randomly display the files under the current directory as the home page.
random index presentation
The ngx_http_random_index_module handles requests with the suffix '/' and randomly selects a page from the current directory as the home page. This module will be executed before the ngx_http_index_module. By default, this module is not installed, you need to install nginx with the configuration parameter--with-http_random_index_module.
Random home page configuration
location / { random_index on; }
random index
Syntax: random_index on| off;
default: random_index off;
Configuration segment: location
Enable or disable the random index module
Generate blank images (empty_gif module)
Have you noticed that Baidu uses 1x1 blank pictures to pass statistical parameters, and whether the brothers who do asynchronous statistics use static files to pass parameters? Why use blank pictures instead of storing a small picture yourself? The blank pictures in nginx are stored in memory, and the speed is definitely faster than reading on the hard disk. See how to use empty_gif to generate a blank image that responds to 1x1.
nginx default built-in ngx_http_empty_gif_module, how to install nginx I will not talk more. Look at the empty_gif.
nginx configuration
The nginx module ngx_http_empty_gif_module responds to 1x1 gif images.
location = /_.gif { empty_gif;}
Here is my nginx configuration
server { listen 80; server_name test.ttlsa.com; access_log /data/logs/nginx/test.ttlsa.com.access.log main; index index.html index.php index.html; root /data/site/test.ttlsa.com; location ~* /3145/ { empty_gif; }}
Test empty_gif
Visit test.ttlsa.com/3145/and the results are as follows:
empty_gif command
Syntax: empty_gif;
Default: -
Configuration segment: location
Open Response 1x1 Blank Picture
The above is about "how to configure Nginx server to display random home page and blank picture" The content of this article, I believe everyone has a certain understanding, I hope the content shared by Xiaobian is helpful to everyone, if you want to know more related knowledge content, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.